diff options
author | jb <jb@FreeBSD.org> | 1998-04-03 09:31:15 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-04-03 09:31:15 +0000 |
commit | 6a1d5a165901cbf6b76376a6c35d2306b55a2f72 (patch) | |
tree | 1c3148ba26408447be3c48a1afe9b17da5335d40 /lib/libpthread/thread/thr_create.c | |
parent | a6ff3fe2e91fc381861cc7c8409c5d66ba9cdf6c (diff) | |
download | FreeBSD-src-6a1d5a165901cbf6b76376a6c35d2306b55a2f72.zip FreeBSD-src-6a1d5a165901cbf6b76376a6c35d2306b55a2f72.tar.gz |
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!
Diffstat (limited to 'lib/libpthread/thread/thr_create.c')
-rw-r--r-- | lib/libpthread/thread/thr_create.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c index da00e4d..412f558 100644 --- a/lib/libpthread/thread/thr_create.c +++ b/lib/libpthread/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: */ |