Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2001-07-31 14:50:35


> > > > why not "static thread& thread::current()" ?
> > >
> > > Think of other threads that need to see that thread's handle.
> >
> > go on, please.
>
> I use it for two different reasons: queueing APC's to other threads, and
> waiting for termination.

hmmm.. what is wrong with e.g.

thread::operator HANDLE () const { return handle_; } // for windows
thread::join();

which would allow you to call ::QueueUserAPC( fnAPC,some_thread,dwData )
or ::QueueUserAPC( fnAPC,thread::current(),dwData ) and thread::join
would basically:

::WaitForSingleObject( handle_,INFINITE );
::GetExitCodeThread( handle_,&dwExitCode );
::CloseHandle( handle_ );

i do not see any problems here..

regards,
alexander.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk