Commit Graph

83 Commits

Author SHA1 Message Date
John Birrell
f9c7be5357 Rename static initializer defines for opaque structures so that the
POSIX specified names can be declared in pthread.h.
1998-04-04 10:58:12 +00:00
John Birrell
377aa2cbb6 Move the magic field initialisation to a place when it is more magic. 1998-04-04 07:27:29 +00:00
John Birrell
ed92686917 Add a magic field to the pthread structure to help recognize valid
threads from invalid ones. The pthread structure is opaque to the user
so this change does not cause any incompatibilities.

Hopefully this change will help code that was written for draft 4
fail gracefully if the programmer ignores the compiler warning about
the change in the level of indirection for the argument passed to
pthread_detach(). I got burnt, so I fixed then (expletive deleted)
thing.

These functions comply with the revised standard. That should shut
Terry up!
1998-04-03 09:31:15 +00:00
John Birrell
0122d62264 Fix a problem of indirection unblocking signals that would have caused
signals to be unblocked even if they were already blocked when entering
the function.

Pointed out by: bde
1998-03-22 04:13:23 +00:00
John Birrell
9dbdb44326 When forking a process, only the running thread gets to live. All
other threads never see the light of day and if they leave things
locked, blame POSIX.
1998-03-09 06:54:50 +00:00
John Birrell
03a9d2d7c8 Add FreeBSD/Alpha code to initialise a jmpbuf for a created thread.
Change a bunch of __alpha references to __alpha__.
1998-03-09 04:46:26 +00:00
John Birrell
08d6f1187e Add sched_yield() witch is the draft 10 equivalent of pthread_yield()
from draft 4. Move some of the schedule definitions to sched.h which
is a POSIX header.
1998-03-08 02:37:27 +00:00
Julian Elischer
f5295b34ac Fixes from Jeremy Allison and Terry Lambert for pthreads:
specifically:
uthread_accept.c: Fix for inherited socket not getting correct entry in
                  pthread flags.
uthread_create.c: Fix to allow pthread_t pointer return to be null if
                  caller doesn't care about return.
uthread_fd.c: Fix for return codes to be placed into correct errno.
uthread_init.c: Changes to make gcc-2.8 thread aware for exception stack
                frames (WARNING: This is #ifdef'ed out by default and is
		different from the Cygnus egcs fix).
uthread_ioctl.c: Fix for blocking/non-blocking ioctl.
uthread_kern.c: Signal handling fixes (only one case left to fix,
                that of an externally sent SIGSEGV and friends -
		a fairly unusual case).
uthread_write.c: Fix for lock of fd - ask for write lock, not read/write.
uthread_writev.c: Fix for lock of fd - ask for write lock, not read/write.

Pthreads now works well enough to run the LDAP and ACAPD(with the gcc 2.8 fix)
sample implementations.
1998-02-13 01:27:34 +00:00
Alexander Langer
372787c102 Changed pthread_detach to conform to POSIX, i.e. the single argument
provided is of type pthread_t instead of pthread_t *.

PR:		4320

Return EINVAL instead of ESRCH if attempting to detach an already
detached thread.
1997-12-25 05:07:20 +00:00
Alexander Langer
09bb0da60c Modify the return values to comply with POSIX. Previously these
functions would return -1 and set errno to indicate the specific error.
POSIX requires that the functions return the error code as the return
value of the function instead.
1997-11-25 01:29:16 +00:00
Alexander Langer
3234f7c1cc Added missing source file uthread_sigwait.c.
Submitted by:	Daniel M. Eischen <deischen@iworks.InterWorks.org>
1997-11-24 23:04:29 +00:00
Alexander Langer
666dfc8237 Correct the return value from pthread_cond_timedwait when a timeout
occurs (was EAGAIN, is now ETIMEDOUT).

Submitted by:	Daniel M. Eischen <deischen@iworks.InterWorks.org>
1997-11-23 22:58:26 +00:00
John Birrell
f4084c0544 Bring back nanosleep from the cold.
The addition of the nanosleep syscall was correctly added to
libc/sys/Makefile so that it is renamed as _thread_sys_nanosleep().
This syscall is one of those that libc_r has to re-implement because
the only behaviour is to block the process. So libc_r just ignores the
fact that a nanosleep syscall exists and goes its own way - as it has
done all along .... and now it does again. And now a simple program
can sleep again. Phew.
1997-06-04 13:03:12 +00:00
Alexander Langer
9c49eac672 Fixed overallocation of _thread_fd_table.
PR:		3494
Submitted by:	Steve Bauer <sbauer@rock.sdsmt.edu>
1997-05-13 23:54:22 +00:00
Peter Wemm
a8320cdfe5 Add const in the thread version of nanosleep()'s args 1997-05-12 10:02:18 +00:00
Peter Wemm
757d77dcf5 remove prototype for nanosleep(), it's visible in unistd.h now. 1997-05-12 10:00:46 +00:00
John Polstra
e91cc88467 Bye bye CPLUSPLUSLIB hack! It's not needed any more.
Don't merge this into -2.2 unless you understand the dependencies on
c++rt0, bsd.lib.mk, and gcc -shared.  I.e., let me do it.
1997-05-06 00:49:36 +00:00
John Birrell
7f351fbb21 Use libc makefiles from now on instead of duplicating them in libc_r.
Added Id strings too. It's useful to know who last made a change.
1997-05-03 03:57:21 +00:00
John Birrell
8253a7d685 Set wakeup time in pthread_cond_wait() to `forever' (-1) to prevent
calling thread from being rescheduled based on an unspecified wakeup
time.

Bug/fix pointed out by Alexandre Fenyo <fenyo@email.enst.fr>.
1997-04-11 22:38:22 +00:00
John Birrell
1cec64c4d6 Fix indentations. Sigh. 1997-04-01 22:51:48 +00:00
John Birrell
e710f8d85b Add parentheses to make blocking mode work. 1997-04-01 22:44:18 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Julian Elischer
c840cec7c5 Submitted by: John Birrell
uthreads update from the author.
1997-02-05 23:26:09 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Alexander Langer
d0c9b2a226 Added uthread_attr_destroy.c to SRCS.
Submitted by:	John Birrell <jb@cimlogic.com.au>
1996-12-29 02:51:55 +00:00
Jeffrey Hsu
9144f05e36 Add pthread_mutexattr_init() and pthread_mutexattr_setkind_np(). 1996-11-11 09:09:30 +00:00
Jeffrey Hsu
d8fadc0e80 Add uthread_attr_init.c, uthread_attr_setstacksize.c, uthread_mattr_init.c,
uthread_mattr_kind_np.c, uthread_multi_np.c, and uthread_single_np.c.
1996-11-11 09:08:11 +00:00
Jeffrey Hsu
509de77c10 Moved enum pthread_mutextype to pthread.h.
Add pthread_mutexattr_default definition.
1996-11-11 09:07:05 +00:00
Jeffrey Hsu
f258836a24 Make pthread_getspecific() compliant with the final IEEE pthreads
specification:  return parameter passing changed.
1996-11-11 09:05:29 +00:00
Nate Williams
ae0baddec3 Remove now un-necessary FreeBSD specific code since our timespec
structure now has the correct member names.

Pointed out by: Peter Wemm
1996-09-20 06:33:54 +00:00
Julian Elischer
0f7d684755 Submitted by: John Birrell <cimaxp1!jb@werple.net.au>
Here are the diffs for libc_r to get it one step closer to P1003.1c
These make most of the thread/mutex/condvar structures opaque to the
user. There are three functions which have been renamed with _np
suffixes because they are extensions to P1003.1c (I did them for JAVA,
which needs to suspend/resume threads and also start threads suspended).

I've created a new header (pthread_np.h) for the non-POSIX stuff.

The egrep tags stuff in /usr/src/lib/libc_r/Makefile that I uncommented
doesn't work. I think its best to delete it. I don't think libc_r needs
tags anyway, 'cause most of the source is in libc which does have tags.

also:

Here's the first batch of man pages for the thread functions.
The diff to /usr/src/lib/libc_r/Makefile removes some stuff that was
inherited from /usr/src/lib/libc/Makefile that should only be done with
libc.

also:

I should have sent this diff with the pthread(3) man page.
It allows people to type

make -DWANT_LIBC_R world

to get libc_r built with the rest of the world. I put this in the
pthread(3) man page.  The default is still not to build libc_r.


also:
The diff attached adds a pthread(3) man page to /usr/src/share/man/man3.
The idea is that without libc_r installed, this man page will give people
enough info to know that they have to build libc_r.
1996-08-20 08:22:01 +00:00
John Polstra
82d29a82b5 Added a new module "uthread_autoinit.cc". This is a small C++ module.
It uses a static constructor to call _thread_init() at program start-up
time.  That eliminates the need for any initialization hooks in crt0.o.

Added a symbol reference in "uthread_init.c", to ensure that the new
module will always be pulled in when the archive version of the library
is used.

In "Makefile.inc", defined CPLUSPLUSLIB, so that the constructor will be
properly invoked in the shared library.

Suggested by: Christopher Provenzano, Peter Wemm, and others.
1996-02-17 02:19:37 +00:00
Julian Elischer
012dfd00b3 Reviewed by: julian
Submitted by:	 john birrel

One version of the pthreads library
another will follow with differnt actions under some cases..
not QUITE complete
1996-01-22 00:23:58 +00:00