Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2002-09-16 14:25:42


"Victor A. Wagner, Jr." wrote:
[...]
> > > So, we're going to intentionally put a "timing window" problem into user
> > > code.... multiple join() will work just fine _provided_ that all the
> > > relevant join() requests actually occur _before_ the thread terminates.
> > > Otherwise, all bets are off.
> >
> > What makes you think so?
>
> well, unless you have some way of generating the references at compile
> time, the only way to detect that the reference exists is to wait for the
> join() call. So whether it will ever even be "seen" will depend on whether
> the thread still exists (i.e., not all the other references have "gone away").

http://www.terekhov.de/mythread.c

---
int my_thread_create( my_thread_t* pmt, 
                      void* (*start_routine)(void*), 
                      void* start_routine_arg,
                      int suspended )
  ....
  mt->eState = ( suspended ) ? MTS_START_SUSPENDED : MTS_START_RUNNING;
  mt->ulRefCounter = ( NULL == pmt ) ? 2 : 3; // including TSD reference
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
  if ( 0 != (status = pthread_create( &tid, 
                                      NULL,
                                      &my_thread_start_routine, 
                                      &mts )) ) {
  ....
---
regards,
alexander.

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