JC> DWORD static __stdcall RealThreadProc(void *theClass) {
JC> // Here we invoke the virtual function in the class whose
JC> // address we passed into here...
JC> //
JC> return ((ThreadBase *)theClass)->ThreadProc();
JC> }
Perhaps adding RTTI support to ensure we ARE dealing with a ThreadBase
pointer here... :-)
JC> // I'm not saving the thread ID, because it's pretty close to
JC> // useless. I'm not even sure why they have thread IDs at all.
I dunno about Win32, but I know that in OS/2 you can raise other thread's
priorities, query their state (blocked, running, etc.), block them and,
, kill them. (Mind you killing threads has the expected side effect of
basically destabilizing the entire process and the entire process should then
shut down immediately, preferably with a bit of grace.) All of this requires
the thread ID. I'm pretty sure there is a fair bit of other stuff. (For
example, in my semaphore objects, I need my thread ID in order to figure out
if I am the thread who owns the semaphore or if it is someone else... I can
then also figure out who it is so I can kill it )
--- Maximus/2 3.01
---------------
* Origin: Tanktalus' Tower BBS (PVT) (1:342/708)
|