Bug 18573 - libobjc abuses posix thread ids
Summary: libobjc abuses posix thread ids
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: libobjc (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-11-19 23:48 UTC by matt rice
Modified: 2007-08-14 23:31 UTC (History)
5 users (show)

See Also:
Target: i585-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-12-15 04:54:17

hacky patch which changes "No thread" identifier from 0 to -1 (1.47 KB, patch)
2004-11-19 23:49 UTC, matt rice
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description matt rice 2004-11-19 23:48:03 UTC
libobjc currently returns the threads id in multiple places, and assumes that it
can return NULL as an identifier for "no thread" but posix thread id's are
opqaque, hurd uses a thread id of 0 for the first thread.

i'll attach a patch which while still not correct, should show the problem
areas, and has worked for linux and hurd.
Comment 1 matt rice 2004-11-19 23:49:28 UTC
Created attachment 7570 [details]
hacky patch which changes "No thread" identifier from 0 to -1
Comment 2 Andrew Pinski 2004-11-20 00:02:07 UTC
Confirmed.  Note this patch does not fix the gthr-* file in the gcc directory which are used when 
building the compiler and libobjc together. (__gthread_objc_thread_detach is the function in gthr-*)
Does anyone know an standard invalid thread id.
Comment 3 Andrew Pinski 2005-12-15 21:30:49 UTC
I have a way to fix this but I will not get to it until tomorrow as I am working on fixing PR 25360 first.