Hi,

On 11/14/07 12:18, micke wrote:

Assumed: a real-time thread

When a thread gets blocked, for example waiting for a condvar, this happens:

1. cv_block() is called, this places the thread on a sleepQ.
2. When the codvar is true the thread get off the sleepQ by a call to: 
cv_signal(), cv_broadcast(), or cv_unsleep().

A condition variable isn't really true or false, but I know what you mean.

3. My question, there is also the function rt_wakeup() when is this function involved? Is 
it allways called when a thread "wakesup" no mater the reason? If I want to 
call funcX() when a thread wakes up(for example from a condvar block) is it enough to 
place it in rt_wakeup() or do I need to place it in cv_signal(), cv_broadcast() and or 
cv_unsleep() also?

We have, for example, cv_signal -> sleepq_wakeone_chan -> CL_WAKEUP

CL_WAKEUP is called on the thread to be woken up.  This macro uses a
scheduling ops vector determined by the scheduling class of the
particular thread being woken:

#define CL_WAKEUP(t)            (*(t)->t_clfuncs->cl_wakeup)(t)

rt_wakeup is the cl_wakeup ops vector member for threads in the
realtime class, so it will be called here for your realtime
thread.

Dtrace is great for learning this sort of code, eg

 # dtrace -n rt_wakeup:entry'[EMAIL PROTECTED]()] = count()}'

will collect the stack on all calls to rt_wakeup (actually
a dumb example since there are any number of paths to
wakeup type functions).

Gavin

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to