I have a problem with dynamic creation and destruction of threads. It
seems it is not safe to call ThreadDestroy. The following little program
hangs on the last line:
void * func( void *arg )
int main( int argc, char* argv )
if (pthread_create(&thread, NULL, &func, NULL) != EOK)
printf(“Failed to create.\n”);
if (ThreadDestroy(thread, -1, NULL) == -1)
printf(“Failed to destroy.\n”);
printf(“Destroyed the thread.\n”);
I guess it is a problem of killing the thread inside printf call. printf
is thread safe, nevertheless it doesn’t seem to be ThreadDestroy safe.
Is this a bug, a feature, or a misunderstanding ? May ThreadDestroy be
used at all with libc functions ?
Thanks for any advice.