This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
Re: snap-2004-11-03 breakage
- From: Alexander Terekhov <TEREKHOV at de dot ibm dot com>
- To: "Gisle Vanem" <giva at bgnett dot no>
- Cc: "pthreads-win32" <pthreads-win32 at sources dot redhat dot com>
- Date: Wed, 3 Nov 2004 16:32:39 +0100
- Subject: Re: snap-2004-11-03 breakage
- Sensitivity:
> Code like (from Ettercap)
> pthread_t pid = ec_thread_getpid("golem");
> if (pid != 0)
> ec_thread_destroy(pid);
Code it like
pthread_t tid;
if (ec_thread_getpid("golem",&tid)
ec_thread_destroy(tid);
Don't rely on idiotic pthread_kill() "testing". The standard
doesn't preclude the use of pointers for thread IDs (e.g.
inside pthread_t structure). Pointers become indeterminate and
trigger undefined behavior for any nonassignment access once
the reference storage gets freed. Conforming implementations
are allowed to reclaim/free that referenced storage when
detached thread is terminated or joinable thread is terminated
and joined. Use of "retired" pthread_t values (e.g. as
pthread_kill() argument) after that moment will trigger
undefined behavior.
regards,
alexander.