c - Can pthread_create() thread-ID of detached thread be ephemeral on the stack? -
this question has reply here:
reusing pthread_t variable running threads 3 answersis conforming thread-id argument of pthread_create()
function on stack if thread detached? example
void func() { pthread_t thread; pthread_create(&thread, null, start_func, null); pthread_detach(thread); }
or disappearance of thread-id variable cause problems? i've read standard , couldn't find answer.
based on this answer related question, safe if not utilize pthread_detach
.
since not trying join
in future, there's no reason need maintain around.
c pthreads posix
No comments:
Post a Comment