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


task #5487: cthreads -> pthreads

Submitter:  Thomas Schwinge <tschwinge>
Submitted:  Mon 24 Apr 2006 03:46:31 PM UTC
Category:  The GNU Hurd Should Start On:  Sun 23 Apr 2006 10:00:00 PM UTC
Should be Finished on:  Sun 23 Apr 2006 10:00:00 PM UTC Priority:  * 5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Percent Complete:  100%
Open/Closed:  Closed Planned 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?

* Mandatory Fields

Add a New Comment Rich Markup

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>
Group administrator
Wed 08 Apr 2009 09:46:43 PM UTC, comment #5: 

Here is the latest patch from bddebian from goober.

Samuel Thibault <sthibaul>
Group administrator
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>
Group administrator
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>
Group 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>
Group administrator


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

Attach Files:

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
  • -email is unavailable- added by sthibaul (Posted a comment)
  • -email is unavailable- added by tschwinge (Updated the item)
  • -email is unavailable- added by bddebian (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-02-03 sthibaul StatusNone Done
        Percent Complete0% 100%
        Open/ClosedOpen Closed
    2009-04-08 sthibaul Attached File- Added patch.gz, #17893
    2008-09-30 tschwinge 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?
    2008-09-11 bddebian Attached File- Added hurd_pthread_09102008.diff.gz, #16461
    2006-08-07 tschwinge Attached File- Added zenton-hurd-patches.tgz, #10482

    Back to the top

    Powered by Savane 3.13-8484.
    Corresponding source code