Re: frxThread questions
Re: frxThread questions
- Subject: Re: frxThread questions
- From: Godfrey van der Linden <email@hidden>
- Date: Wed, 23 Apr 2003 16:29:42 -0700
G'day Vivek,
The place to look is <sys/proc.h>.
You won't really find documentation for the except in a tradition
unix book. I suggest you have a look at 'The Design and
Implementation of the 4.4 BSD Operating System', which discusses this
in detail.
Briefly though it seems like the usage on exit is incorrect as I'm
nulling a pointer then passing the address of it as an argument.
Infact the standard Unix sleep()/wakeup() mechanism never
dereferences the 'event' argument. It uses the event as a tag to
indicate which thread that is sleeping needs to be woken up. Thus
this &ftxThread is used to indicate which client tsleep() to wakeup.
It is traditional to use the address of the variable for which you
wish to wait. This allows us to be reasonably sure that nobody else
is using this 'event' without having to provide a data base of all
possible events in a header somewhere.
Godfrey
At 18:47 -0700 03-4-22, Vivek wrote:
Hi. I'm looking at IOSerialBSDClient, and there's some code that I can't
figure out. Inside IOSerialBSDClient::txFunc, there are lines as follows:
// on entry
ftxThread = IOThreadSelf();
ftxThreadLaunched = true;
wakeup((caddr_t) &ftxThread); // wakeup the thread launcher
...
//on exit
ftxThread = NULL;
ftxThreadLaunched = false;
wakeup((caddr_t) &ftxThread); // wakeup the thread killer
ftxThread and ftxThreadLaunched are members of IOSerialBSDClient. I can't
seem to find a likely candidate for wakeup() in Kernel.framework or
/usr/include, and it seems like the exit code, with its null-pointer
argument, may have some pretty bad results.
Can somebody explain what the intent is of this sequence?
Thanks,
Vivek
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.