Kse/Thr _exit implementation

Kai Mosebach kai.mosebach at freshx.de
Thu Jul 10 00:39:33 PDT 2003


Hi again,

i have two other questions regarding the kse/thr implementation:

1.) often i see, that the linuxthreads implematation has problems with
the
exit() function, if not all threads are finished. Is this fixed in kse ?

2.) i found this piece of code in the sapdb, which had to be enabled,
when i used linuxthreads, but with kse it just loops around, so i
removed it. Is this problem described here lthreads only ?

cheers 

------------------------snip

#if defined LINUX || (defined FREEBSD && defined LINUXTHREADS &&
!defined FREEBSD_THREADS)
    if ( pThreadObj->StackSize != 0 ) /* PTS 1106187 */
    {
    /*
     * Some words.... PTS 1105262/1105263
     * There was a LINUX specific crash without this YIELD_CALL loop.
The linuxthread 
     * pthread manager does not synchronize the pthread_join() call with
the actions
     * of freeing internal references to the joined thread. Since these
references are
     * situated on the pthread stack, freeing this stack results in
program crashes depending
     * on the scheduling. Forcing the join to wait until the thread
actually was terminating
     * solves part of this problem. Creating another dummy thread solves
the synchronization.
     */
    /* PTS 1105678 poll after join not before join... and use kill
instead of pthread_kill */
      while ( kill( pThreadObj->thread_id, 0) == 0 )
      {
        sleep(1); /* YIELD_CALL; */ /* let him finsh */
      }
    }
#endif



More information about the freebsd-threads mailing list