Commit Graph

297 Commits

Author SHA1 Message Date
jeff
01344bee59 - Define a _spinunlock() function so that threading implementations may do
more complicated things than just setting the lock to 0.
 - Implement stubs for this function in libc and the two threading libraries
   that are currently in the tree.
2003-03-26 04:02:24 +00:00
davidxu
e1913fdc9c Backout last commit.
Requested by: jhb
2003-03-15 04:45:42 +00:00
davidxu
aeda9ec958 Fix a bug in rwlock. When a rwlock was locked by reader threads, a
writter thread can block reader threads to get read lock.
2003-03-14 01:02:47 +00:00
phantom
c81c056bcc Fix cut'n'paste error
Noticed by:	julian
2003-03-05 20:50:03 +00:00
phantom
7a4e72e2eb MFlibc_r: add and document pthread_attr_get_np() function. 2003-03-03 22:40:20 +00:00
davidxu
88f6b31fa9 Fix compiling error. 2003-02-26 08:28:28 +00:00
mini
507892f328 Insert threads interrupted by a signal while running onto the run queue. 2003-02-23 21:15:25 +00:00
mini
d9a841dc8d Add signal logic to the build. 2003-02-23 21:14:08 +00:00
mini
b6da94e029 Deliver signals posted via an upcall to the appropriate thread. 2003-02-17 10:05:18 +00:00
alfred
1aac706e63 Actually link in the attr_{set,get}stack. 2003-02-11 07:28:28 +00:00
alfred
9a7e110c84 Add pthread_attr_getstack() and pthread_attr_setstack().
Submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-02-10 08:48:04 +00:00
fjoe
fb561a29b2 remove #ifdef _THREAD_SAFE 2003-01-24 01:46:30 +00:00
deischen
c707472879 For now, build and install this as libkse instead of libpthread.
This will avoid any accidental use of an experimental library.

Suggested by:	rwatson
Approved by:	re (jhb)
2002-12-08 22:43:31 +00:00
mini
25bd85aed0 Schedule spinlocked threads by moving them through the work queue, instead
of the wait queue.

Approved by: re (blanket)
Stolen from: davidxu
2002-11-24 06:45:45 +00:00
mini
71ed6b09a9 Get the wall clock time from the KSE mailbox, rather than doing another
syscall.
2002-11-24 06:43:21 +00:00
davidxu
042c7fec24 In _thread_enter_uts, fix eflags saving bug.
In _thread_switch, set current thread pointer in kse mailbox
only after all registers copied out of thread mailbox, kernel will do
upcall at trap time, if set current thread pointer before loading all
registers from thread mailbox, at trap time, the thread mailbox data
will be overwritten by kernel, result is junk data is loaded into CPU.
2002-11-22 11:43:06 +00:00
davidxu
0f68381e53 Fix idle timeout bug, use correct current time of day. 2002-11-20 12:35:59 +00:00
davidxu
e852ee1807 Adjust code for new mailbox format.
Reviewed by: deischen, mini
2002-11-18 02:02:08 +00:00
mini
fe1adb9794 Schedule an idle context to block until timeouts expire without blocking
further upcalls.
2002-11-12 00:55:01 +00:00
mini
88004693e3 Make pthread_sigmask(3) operate on the thread signal mask, not the process
signal mask.
2002-10-30 07:13:27 +00:00
mini
02fc8b20b5 Use KSE to schedule threads. 2002-10-30 06:07:18 +00:00
robert
62f9b18f6f Add the 'restrict' type qualifier to the prototypes of `sigaction',
`sigprocmask', `sigaltstack', and `sigwait' as well as to the
prototypes of the apparantly unimplemented functions `sigtimedwait'
and `sigwaitinfo'.  This complies with IEEE Std 1003.1-2001.
2002-10-02 10:53:44 +00:00
peter
8d8b96d08c Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
mini
c6b4c83268 Make libpthread KSE aware.
Reviewed by:	deischen, julian
Approved by:	-arch
2002-09-16 19:52:52 +00:00
mini
141ea5ab5c Mechanically change all libc_r references to libpthread. 2002-09-16 19:29:34 +00:00
mini
fc6481bdd1 Make the changes needed for libpthread to compile in its new home.
The new libpthread will provide POSIX threading support using KSE.
These files were previously repo-copied from src/lib/libc_r.

Reviewed by:	deischen
Approved by:	-arch
2002-09-16 08:45:36 +00:00
deischen
f33bb8954f Remove much of the dereferencing of the fd table entries to look
at file flags and replace it with functions that will avoid null
pointer checks.

MFC to be done by archie ;-)

PR:		42100
Reviewed by:	archie, robert
MFC after:	3 days
2002-08-29 23:06:07 +00:00
archie
e9e37212c4 Make the libc_r version of select() set the readable or writable
file descriptor bit if poll() returns POLLERR, POLLHUP, or POLLNVAL.
Othewise, it's possible for select() to return successfully but
with no bits set.

Reviewed by:	deischen
MFC after:	3 days
PR:		bin/42175
2002-08-29 21:39:19 +00:00
archie
256320cb58 When poll(2)'ing for readability or writability of a file descriptor
on behalf of a thread, we should check the POLLERR, POLLHUP, and
POLLNVAL flags as well to wake up the thread in these cases.

Suggested by:	deischen
MFC after:	3 days
2002-08-29 00:44:11 +00:00
charnier
06afb62b3c Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
deischen
b6d9a54d77 Oops, forgot to set the suspended flag for threads that are created
initially suspended.  This was preventing such threads from getting
resumed.

Reported by:	Bill Huey <billh@gnuppy.monkey.org>
2002-07-09 13:24:52 +00:00
deischen
16a3a12cbd Fix a couple of minor nits that prevented this from compiling.
Pointed out by:	julian
2002-07-02 01:26:16 +00:00
deischen
21e4c95b99 Make sigpending and sigsuspend account for signals that are pending on
the process as well as pending on the current thread.

Reported by:	Andrew MacIntyre <andymac@bullseye.apana.org.au>
2002-06-28 13:28:41 +00:00
deischen
8bea1ae86b Add a wrapper for pselect() in order to make it a cancellation point.
Prompted by: wollman
2002-06-28 13:26:02 +00:00
rwatson
7ddef0ce3b Missed in earlier commit -- I did cvs commit src/lib/libc. Oops. 2002-06-14 04:02:25 +00:00
deischen
ae9467478a Revamp suspend and resume. While I'm here add pthread_suspend_all_np()
and pthread_resume_all_np().  These suspend and resume all threads except
the current thread, respectively.  The existing functions pthread_single_np()
and pthread_multi_np(), which formerly had no effect, now exhibit the same
behaviour and pthread_suspend_all_np() and pthread_resume_all_np().  These
functions have been added mostly for the native java port.

Don't allow the uthread kernel pipe to use the same descriptors as
stdio.  Mostily submitted by Oswald Buddenhagen <ossi@kde.org>.

Correct some minor style nits.
2002-05-24 04:32:28 +00:00
alfred
21a6cce89d Undo namespace pollution by prefixing the globals pthread_guard_default and
pthread_page_size.

Fix a bunch line wrapping.

Pointed out by: deischen
2002-05-15 05:37:48 +00:00
alfred
dd6fc3471f Don't use PAGE_SIZE in userland, instead use getpagesize(), this is to
allow running on other arches when the instructions are supported but
the page size granularity is not.

Glanced at by: peter
2002-05-13 07:58:15 +00:00
alfred
64866827d8 Use GCC's __attribute__ ((constructor)) mechanism to invoke the pthread
startup code rather than a static C++ object since c++ seems to be broken.

This doesn't seem to work for staticically linked program just yet, I'll
give that some more work when I get a chance.
2002-05-11 08:13:42 +00:00
archie
f5f7bb8de6 Make these functions cancellation points like they should be:
poll(2), readv(2), select(2), wait4(2), writev(2).

PR:		bin/37658
Reviewed by:	deischen
MFC after:	1 week
2002-05-02 19:58:43 +00:00
archie
15e73cd042 Make sure calls to pthread_cancel() do not take effect if the target
thread is already exiting.

PR:		bin/37614
Reviewed by:	deischen
MFC after:	1 week
2002-05-02 19:57:59 +00:00
des
c91c856b3e Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
obrien
b639f0e851 The GCC developers have made good on their threats against #pragma for 3.1.
Use __weak_reference in place of the #pragma.

Submitted by:	eischen
2002-04-15 23:11:38 +00:00
obrien
f5037f7f96 Sync SCM ID comments with libc. 2002-04-15 20:22:28 +00:00
asmodai
699f04d19a Return correct number of total bits set in all fd_set's.
Change case of POLLNVAL as an error.
Remove POLLHUP and POLLERR from one case, their place is most likely
amongst read events.

PR:		33723
Submitted by:	Alexander Litvin <archer@whichever.org>
Reviewed by:	deischen [Provided a small change to the PR patch as well]
MFC after:	4 weeks
2002-04-09 05:41:00 +00:00
markm
146609ba72 Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
2002-03-29 22:43:43 +00:00
deischen
c9f547415e Add the ability to recognize old references to keys, and return NULL
when old keys are referenced (after pthread_key_delete()) via
pthread_getspecific().
2002-03-19 22:58:56 +00:00
bsd
8a66510c0f Fix the return code from pthread_rwlock_try[rw|rd]lock() functions;
these should return EBUSY when the calling thread would block.

MFC after: 2 weeks
2002-03-15 18:27:58 +00:00
deischen
a4947b12c9 Properly clear the status of a join operation if the joining thread is
canceled or the joinee is detached.
2002-03-06 19:28:41 +00:00
deischen
29c9771f3e Don't rely on <sys/signal.h> to include <sys/ucontext.h> 2002-02-17 17:21:27 +00:00