Bug 80044 - Deprecate header inclusion of pthread.h and add a define option to disable inclusion of pthread.h
Summary: Deprecate header inclusion of pthread.h and add a define option to disable in...
Status: RESOLVED MOVED
Alias: None
Product: XCB
Classification: Unclassified
Component: Library (show other bugs)
Version: unspecified
Hardware: Other All
: lowest normal
Assignee: xcb mailing list dummy
QA Contact: xcb mailing list dummy
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-15 02:54 UTC by Steven Stewart-Gallus
Modified: 2019-02-16 19:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Steven Stewart-Gallus 2014-06-15 02:54:16 UTC
As far as I can tell the only place pthread.h is included or used is in xcb/xcb.h. Because libraries may have grown to depend upon the inclusion it will not be possible to simply remove pthread.h from the header file. However, adding a check for a define (maybe "XCB_NO_INCLUDE_PTHREAD") that disables the inclusion of pthread.h would be backwards compatible. Then perhaps in the far flung future the inclusion of pthread.h could be disabled by default.

This issue is important to me because I am interested in statically analysing my programs and to do so I use a custom set of headers for libc which are specially annotated. Because statically analysing multithreading is really, really hard the headers for pthreads have not been implemented yet and so the static analyser falls back to the system's headers which causes the build to fail. I would like to be able to disable inclusion of pthread.h and so statically analyse my program. Of course, I can use an ugly hack to work around the issue by defining the header guard _PTHREAD_H in my program so the issue is not at all urgent but eventually in the far flung future I'd like to get rid of it. Also, statically analysing a big interface such as a GUI is very hard and not something to bother putting much effort in so this issue is also not important in that way. I feel this should be done eventually though. I feel this issue should be solved eventually though.

This issue will eventually make for very, very, slightly faster build times.
Comment 1 Alan Coopersmith 2014-06-15 16:38:18 UTC
We can't just remove it, as xcb uses the pthread synchronization functions
heavily internally, though it could possibly be moved from xcb.h to xcbint.h.

We do provide stubs for use in single-threaded programs that don't need
thread safety:
http://cgit.freedesktop.org/xcb/pthread-stubs/
Comment 2 Steven Stewart-Gallus 2014-06-15 23:07:36 UTC
Alan, XCB's internal use of pthread's is not a problem. XCB's internal
uses of the headers would simply not define "XCB_NO_INCLUDE_PTHREAD"
and everything would work as it does today. Only far off in the future
when "XCB_NO_INCLUDE_PTHREAD" is made the default would the pthread.h
inclusion have to be moved to xcbint.h.
Comment 3 GitLab Migration User 2019-02-16 19:40:19 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/lib/libxcb/issues/7.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.