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


task #5487: cthreads -> pthreads

Submitted by:  Thomas Schwinge <tschwinge>
Submitted on:  Mon 24 Apr 2006 03:46:31 PM UTC  
Category: The GNU HurdShould Start On: Sun 23 Apr 2006 10:00:00 PM UTC
Should be Finished on: Sun 23 Apr 2006 10:00:00 PM UTCPriority: 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 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 03 Feb 2013 07:52:59 PM UTC, comment #6:

This was commited some time ago.

Samuel Thibault <sthibaul>
Project Member
Wed 08 Apr 2009 09:46:43 PM UTC, comment #5:

Here is the latest patch from bddebian from goober.

Samuel Thibault <sthibaul>
Project Member
Mon 30 Mar 2009 08:37:57 PM UTC, 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 11 Sep 2008 12:32:25 AM UTC, 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 01 Dec 2006 01:23:39 AM UTC, 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 07 Aug 2006 02:49:21 PM UTC, 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 24 Apr 2006 03:46:31 PM UTC, 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 (124KiB - application/x-gzip - latest patch from bddebian)
file #16461:  hurd_pthread_09102008.diff.gz added by bddebian (131KiB - application/x-gzip - hurd_pthread_09102008.diff.gz)
file #10482:  zenton-hurd-patches.tgz added by tschwinge (49KiB - 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 03 Feb 2013 07:52:59 PM UTCsthibaulStatusNone=>Done
      Percent Complete0%=>100%
    Wed 08 Apr 2009 09:49:32 PM UTCsthibaulAttached File-=>Added patch.gz, #17893
    Tue 30 Sep 2008 09:10:29 AM UTCtschwingeWiki-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 11 Sep 2008 12:36:20 AM UTCbddebianAttached File-=>Added hurd_pthread_09102008.diff.gz, #16461
    Mon 07 Aug 2006 02:49:21 PM UTCtschwingeAttached File-=>Added zenton-hurd-patches.tgz, #10482

    Back to the top

    Powered by Savane 3.1-cleanup1