From 6a1d5a165901cbf6b76376a6c35d2306b55a2f72 Mon Sep 17 00:00:00 2001 From: jb Date: Fri, 3 Apr 1998 09:31:15 +0000 Subject: Add a magic field to the pthread structure to help recognize valid threads from invalid ones. The pthread structure is opaque to the user so this change does not cause any incompatibilities. Hopefully this change will help code that was written for draft 4 fail gracefully if the programmer ignores the compiler warning about the change in the level of indirection for the argument passed to pthread_detach(). I got burnt, so I fixed then (expletive deleted) thing. These functions comply with the revised standard. That should shut Terry up! --- lib/libkse/thread/thr_create.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/libkse/thread/thr_create.c') diff --git a/lib/libkse/thread/thr_create.c b/lib/libkse/thread/thr_create.c index da00e4d..412f558 100644 --- a/lib/libkse/thread/thr_create.c +++ b/lib/libkse/thread/thr_create.c @@ -60,6 +60,12 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, /* Insufficient memory to create a thread: */ ret = EAGAIN; } else { + /* + * Write a magic value to the thread structure to help + * identify valid ones: + */ + new_thread->magic = PTHREAD_MAGIC; + /* Check if default thread attributes are required: */ if (attr == NULL || *attr == NULL) { /* Use the default thread attributes: */ -- cgit v1.1