mod/maxgui.mod/fltkmaxgui.mod/src/Fl_mac.cxx
void DataReady::CancelThread(const char *reason)
{
  if ( tid )
  {
    DEBUGMSG("*** CANCEL THREAD: ");
    DEBUGMSG(reason);
    if ( pthread_cancel(tid) == 0 )		// cancel first
    {
      DataLock();
      /*LOCK*/  write(_cancelpipe[1], "x", 1);	// wake thread from select
      DataUnlock();
      pthread_join(tid, NULL);			// wait for thread to finish
    }
    tid = 0;
    DEBUGMSG("(JOINED) OK\n");
  }
  // Close pipe if open
  DataLock();
  /*LOCK*/  if ( _cancelpipe[0] ) { close(_cancelpipe[0]); _cancelpipe[0] = 0; }
  /*LOCK*/  if ( _cancelpipe[1] ) { close(_cancelpipe[1]); _cancelpipe[1] = 0; }
  DataUnlock();
}
// CANCEL 'DATA READY' THREAD, CLOSE PIPE
CANCEL 'DATA READY' THREAD, CLOSE PIPE
CANCEL ' DATA READY ' THREAD CLOSE PIPE
void DataReady::CancelThread(const char *reason)
{
  if ( tid )
  {
    DEBUGMSG("*** CANCEL THREAD: ");
    DEBUGMSG(reason);
    if ( pthread_cancel(tid) == 0 )		
    {
      DataLock();
        write(_cancelpipe[1], "x", 1);	
      DataUnlock();
      pthread_join(tid, NULL);			
    }
    tid = 0;
    DEBUGMSG("(JOINED) OK\n");
  }
  DataLock();
    if ( _cancelpipe[0] ) { close(_cancelpipe[0]); _cancelpipe[0] = 0; }
    if ( _cancelpipe[1] ) { close(_cancelpipe[1]); _cancelpipe[1] = 0; }
  DataUnlock();
}
void DataReady :: CancelThread ( const char * reason ) { if ( tid ) { DEBUGMSG ( " " ) ; DEBUGMSG ( reason ) ; if ( pthread_cancel ( tid ) == 0 ) { DataLock ( ) ; write ( _cancelpipe [ 1 ] , " " , 1 ) ; DataUnlock ( ) ; pthread_join ( tid , NULL ) ; } tid = 0 ; DEBUGMSG ( " \n " ) ; } DataLock ( ) ; if ( _cancelpipe [ 0 ] ) { close ( _cancelpipe [ 0 ] ) ; _cancelpipe [ 0 ] = 0 ; } if ( _cancelpipe [ 1 ] ) { close ( _cancelpipe [ 1 ] ) ; _cancelpipe [ 1 ] = 0 ; } DataUnlock ( ) ; }
CANCEL 'DATA READY' THREAD, CLOSE PIPE
CANCEL ' DATA READY ' THREAD CLOSE PIPE
// cancel first /*LOCK*/ // wake thread from select // wait for thread to finish // Close pipe if open /*LOCK*/ /*LOCK*/