taskThe GNU Hurd - Tasks: task #5487, cthreads -> pthreads


task #5487: cthreads -> pthreads

Submitted by:  Thomas Schwinge <tschwinge>
Submitted on:  Mon Apr 24 15:46:31 2006  
Category: The GNU HurdShould Start On: Sun Apr 23 22:00:00 2006
Should be Finished on: Sun Apr 23 22:00:00 2006Priority: 5 - Normal
Status: DonePrivacy: Public
Percent Complete: 100%Assigned to: None
Open/Closed: ClosedPlanned Release: None
Effort: 0.00
Wiki-like text discussion box: 

Would it help to have this stuff available in a CVS branch? The copyright of all involved contributors is assigned to the FSF, right?

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Sun Feb 3 19:52:59 2013, comment #6:

This was commited some time ago.

Samuel Thibault <sthibaul>
Project Member
Wed Apr 8 21:46:43 2009, comment #5:

Here is the latest patch from bddebian from goober.

Samuel Thibault <sthibaul>
Project Member
Mon Mar 30 20:37:57 2009, comment #4:

Just a follow-up about the patch:

- Barry's tree is in goober:/devel/bdefreese/hurd-pthread3/hurd
- Note the code in urfs/pager.c: it looks inside the rwlock in an ugly
way. It looks like it is just trying to wait for the read lock to be
available, but not actually lock.
- Condition implications have to be implemented. Barry has written some
code which isn't in the patch attached to this task, just in his tree
- Note that libpthread does already provide some compatibility stuff in
cthread-compat, which provides a few cthread symbols. That is needed
for glibc that itself uses a few cthread things, like mutexes.
- As Barry mentioned, there are some linking issues: when linking
statically, the "ascii version" of libpthread.a needs to be used,
i.e. not the binary but the linker script that adds undefined
references to a few compatibility cthread functions. Else the
initialization wouldn't be done and we'd get a __pthread_threads
assertion failure. The Makefiles should be fixed so that this is
correctly done.
- Also, remembemer when testing all of this to apply the TLS patch,
e.g. the one available in the debian package, else it'll just fail.
- spinlocks should rather be just statically initialized instead of
adding constructor functions.
- calls to pthread_spin_trylock should be fixed: Barry didn't notice
that the returned value wasn't the same as in cthreads.

Samuel Thibault <sthibaul>
Project Member
Thu Sep 11 00:32:25 2008, comment #3:

OK I'm attaching my latest patch. I've taken zentons work and taken it all the way. Everything compiles but there are issues.

Static linking has issues. If I let the build system do it's thing, ext2fs and ext2fs --help return values however its linked to the binary libpthread. If I link against the ascii pthread in hurd/libpthread it either gives some goofy errors or hangs. For some reason I cannot get gdb to give me debugging symbols or it hangs even inside of gdb and I can't attach to the pid because ps also hangs.

I have added pt-cond-implies but it is not completed and neal thinks the code should be inlined anyway.

Obviously it needs testing, testing, testing.

Barry deFreese <bddebian>
Fri Dec 1 01:23:39 2006, comment #2:

As far as I got it, Hurd-specific part of threads are very related with cancelation stuff. We really need hurd_condition_wait and hurd_thread_cancel or it would be possible to adapt Hurd to use pthread_thread_cancel?

Mon Aug 7 14:49:21 2006, comment #1:

Attached is the work that Vicente Hernando Ara has been doing years ago, see <http://web.archive.org/web/20040213013636/es.gnu.org/~zenton/Pthread/>.

Copyright is assigned to the FSF.

This effort is unfinished.

Thomas Schwinge <tschwinge>
Project Administrator
Mon Apr 24 15:46:31 2006, original submission:

Currently the Hurd libraries and servers use cthreads for threading, which is what Mach provides. To gain greater portability, the libraries and servers should be ported to pthreads (which we also have a mostly functional implementation for in the Hurd). Work on this task had already started years ago (with patches for a number of libraries), but then stalled again. (This work can be made available.)

This task involves going through the source files for changing the cthreads calls to pthread ones, taking care for more difficult situations that can not be mapped one to one and finally (or incrementally where possible) testing the results. Perhaps there will also be some bug hunting / fixing in our pthread implementation to be done.

Thomas Schwinge <tschwinge>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #17893:  patch.gz added by sthibaul (124kB - application/x-gzip - latest patch from bddebian)
file #16461:  hurd_pthread_09102008.diff.gz added by bddebian (131kB - application/x-gzip - hurd_pthread_09102008.diff.gz)
file #10482:  zenton-hurd-patches.tgz added by tschwinge (49kB - application/x-compressed-tar)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by sthibaul (Posted a comment)
  • -unavailable- added by tschwinge (Updated the item)
  • -unavailable- added by bddebian (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Feb 3 19:52:59 2013sthibaulStatusNone=>Done
      Percent Complete0%=>100%
    Wed Apr 8 21:49:32 2009sthibaulAttached File-=>Added patch.gz, #17893
    Tue Sep 30 09:10:29 2008tschwingeWiki-like text discussion box=>Would it help to have this stuff available in a CVS branch? The copyright of all involved contributors is assigned to the FSF, right?
    Thu Sep 11 00:36:20 2008bddebianAttached File-=>Added hurd_pthread_09102008.diff.gz, #16461
    Mon Aug 7 14:49:21 2006tschwingeAttached File-=>Added zenton-hurd-patches.tgz, #10482

    Back to the top

    Powered by Savane 3.1-cleanup1