Commit Graph

369 Commits

Author SHA1 Message Date
thorpej d93ab54e03 Use TOOL_GENASSYM. Part of PR toolchain/30350 2005-05-30 16:02:56 +00:00
nathanw 5f7a108732 Avoid passing along a timespec with a negative number of seconds if
the current time plus the caller-supplied time to sleep wraps the
time_t. Instead, sleep until INT_MAX.
2005-04-19 16:38:57 +00:00
matt 38b7b2fcde Merge updates to algorithms from i386 switch code. 2005-04-09 20:53:19 +00:00
matt 7fa678813d Add STACKSPACE 2005-04-09 20:50:27 +00:00
matt e722e50c79 Rework and cleanup. Don't use REI, fake a call frame instead. 2005-04-09 20:49:02 +00:00
kleink 9cf9c2316b Add restrict qualifiers to <pthread.h> function arguments. 2005-03-21 17:55:07 +00:00
kleink 34579587e1 Include <sys/select.h> explicitly rather than relying on other headers
to do it.
2005-03-21 09:00:49 +00:00
kleink 363c26d4ba Interpose cancellation points in pollts() and pselect(), bringing us
to libc.so.12.127 and libpthread.so.0.6.
2005-03-18 11:23:44 +00:00
jwise f579845294 Lint warning police -- don't use `//' for comments in C code. 2005-03-17 17:23:21 +00:00
kleink ebf592f1e6 Move up the definition of __LIBC12_SOURCE__; since <poll.h> now includes
<sys/sigtypes.h> this is needed earlier.
2005-03-10 00:34:23 +00:00
nathanw 22f226cf84 Correct the order of arguments to __sigplusset() in two places to correct
the signal mask experienced by signal handlers in threaded programs.
Fixes regress/lib/libpthread/sigmask3.
2005-02-27 18:25:01 +00:00
nathanw 916de87872 Keep the kernel updated with signal action signal masks (act.sa_mask) until
threads are started, since before that the traditional signal invocation
method will be used. Fixes regress/lib/libpthread/sigmask2.
2005-02-26 20:33:06 +00:00
nathanw 1eaf7124f7 Fetch the old signal mask for the signal action whether or not we're
setting a new signal action; this makes sigaction(sig, NULL, &oact)
return a sensible value in the signal mask instead of stack trash.

Addresses PR lib/29536.

XXX the mask seen by signal handlers in a program linked with
libpthread but not yet multithreaded will not reflect masks set here.
2005-02-26 18:15:25 +00:00
christos b35aef8d4b Default back pthread__concurrency to 1 until we fix the regression test
related to pthread_kill().
2005-02-10 23:42:37 +00:00
christos 3a610280bb If $PTHREAD_CONCURRENCY is not set, set it to ncpu 2005-02-10 02:20:49 +00:00
christos cca9405683 Add charles' mlock fixes, protected with PTHREAD_MLOCK_KLUDGE and enabled
by default, until we come up with a real fix.
2005-02-03 17:30:33 +00:00
daniel 760b46e0e9 Document PTHREAD_CONCURRENCY, ack by wiz@. 2005-02-01 11:38:27 +00:00
nathanw efffd0e96a pthread_rwlock_timedrdlock() and pthread_rwlock_timedwrlock():
After exiting the try-again loop, make one more test of the lock
conditions, in case it was released while a signal handler kept the
thread busy past the alarm expiration.
2005-01-09 01:57:38 +00:00
nathanw 6a562a3a84 pthread_rwlock_timedrdlock() and pthread_rwlock_timedwrlock():
Expand the test for valid values of abs_timeout to check for negative
values of tv_sec and tv_nsec.
2005-01-09 01:47:20 +00:00
mycroft 6951dd53b1 Fix a pasto. 2005-01-06 17:42:31 +00:00
mycroft 077972bfb2 Replace the even-odd test for incrementing unblockgen with a simple
blockgen!=unblockgen.  I'm not sure this is 100% correct, but it partly
alleviates a problem with multiple unblocks for the same thread getting
stacked up.
2005-01-06 17:40:22 +00:00
mycroft 75a9478818 Add some additional assertions and debugging printf()s. 2005-01-06 17:38:29 +00:00
mycroft e890aef258 Use TIMER_RELTIME rather than the constant 0 in one place. 2005-01-06 17:34:52 +00:00
mycroft 8fa85b4a65 gettimeofday();TIMEVAL_TO_TIMESPEC(); is exactly equivalent to
clock_gettime(CLOCK_REALTIME), except the latter may have more preicison
some day.  So, use that.
2005-01-06 17:33:36 +00:00
nathanw 74718675cc Avoid passing zero-valued timespecs to timer_settime() when we want to set
a timer, as that will clear the timer instead. Pass in a safely in-the-past
value instead.
Addresses PR lib/28700.

(XXX passing in values between 0 and 1000 nanoseconds will still fail, but
 that bug needs to be fixed in timer_settime(), not here)
2004-12-29 20:47:39 +00:00
nathanw fae5965c52 Implement pthread_attr_{set,get}schedpolicy() at the same level as the other
scheduling stuff: only handle SCHED_OTHER. Like the rest of the scheduling
stuff, this is for the benefit of code that can't be bothered to test against
_POSIX_THREAD_PRIORITY_SCHEDULING.
2004-12-29 00:59:57 +00:00
wiz c53d75fdd8 Grammar improvements. 2004-12-15 16:37:58 +00:00
wiz dd4b29f9a3 Fix typo in comment. 2004-12-15 16:29:53 +00:00
yamt e19f3f9976 document sched_yield. 2004-12-14 01:47:13 +00:00
nathanw 480a2816f2 Add #defines to make use of libc stubs for pthread_cond_wait() and
pthread_cond_timedwait().

XXX as noted in the comments, in the situations where these are
useful, they should never be called in a single-threaded
process. Perhaps they should die rather than return 0.

Addresses xsrc/28630.
2004-12-13 03:10:52 +00:00
nathanw cb9ebec1e2 Correctly return ETIMEDOUT when the absolute time is in the past, in
the nonthreaded case. Fixes, and fix from, PR lib/25961.
2004-12-10 17:11:53 +00:00
nathanw 0eaa8971b7 Use CPP macros to cause many libpthread functions used by applications
to be transformed into the do-nothing-when-libpthread-isn't-linked libc
stub names. This will permit library code that uses <pthread.h> and pthread
functions "defensively" to not need to link against libpthread and not need
to be patched to the threadlib.h API.
2004-12-10 16:40:40 +00:00
skrll 32069ca6a3 pt_sleepuc was removed a long time ago. 2004-12-01 14:27:01 +00:00
nathanw 45204d9ceb Punt to setcontext() system call if the PSL_T bit (single-step trap)
is set, so that the single-step trap happens in the thread's context
and not in the middle of _setcontext_u.

XXX might be able to do something here with iret, too, but it needs
more testing.
2004-11-30 21:05:01 +00:00
kent 63a8cde231 save&restore %fs and %gs registers for USER_LDT applications.
PR#26900
2004-11-10 01:12:57 +00:00
fvdl 5febc5eef5 Fix thread context switching to take the stack ABI into account.
From Wolfgang Solfrank.
2004-10-21 16:49:47 +00:00
mycroft 2b4ccae3e9 Remove pt_blockuc. If the debugger attempts to muck with the state of a
blocked thread, return an error; this should be done through ptrace(2).
2004-10-12 22:17:56 +00:00
nathanw 7c7a36f21d In nanosleep(), loop until the timer fires or a signal is taken; other
spurious wakeups (such as those caused by gdb) should not cause
nanosleep to return prematurely.
2004-08-24 02:08:08 +00:00
nathanw f83d3766b4 Mark when a thread has taken a signal. 2004-08-24 01:46:30 +00:00
nathanw 3f53b40ca7 Local whitespace police. 2004-08-24 01:45:54 +00:00
nathanw 15c2d9148c Add a flag that indicates that a thread took a signal. 2004-08-24 01:44:08 +00:00
rearnsha cd8021f51e Use RET macro for returning. 2004-08-21 11:31:44 +00:00
chs c6736a59b3 redo the fix for PR 26392 differently: instead of changing the stack bounds
for the initial stack, just change the initial thread's pt_uc to point to
the opposite end of the stack (away from the argv, environment, etc).
2004-08-17 14:16:00 +00:00
yamt 6b2b9c625f - fix pthread_detach with an already exit'ed thread.
namely, put the thread to deadqueue rather than just leaking it.
- fix a race between pthread_detach/join and pthread_exit,
  which also causes dead thread leaks.
2004-08-12 10:54:13 +00:00
yamt 129567b88f pthread_rwlock_timedrdlock/pthread_rwlock_timedwrlock:
fix lock/unlock inversions in ERRORCHECK.
2004-08-03 11:50:45 +00:00
yamt 5fc4e57d71 pthread_rwlock_timedwrlock: return ETIMEDOUT appropriately. 2004-08-03 11:40:24 +00:00
nathanw 8bf7374bcf In cond_wait() and cond_timedwait(), do the ERRORCHECK testing of the
waiters list in all cases, not just on cancellation; there are other
sources of spurious wakeups, such as single-stepping in the debugger.

regress/lib/libpthread/conddestroy1 now passes.
2004-07-27 21:44:48 +00:00
chs 503ca60040 in pthread__initmain(), don't reuse the part of the initial stack that
is occupied by the argv and environment (and MD stuff like the page-table
mapping on x86).  fixes PR 26392.
2004-07-25 23:22:43 +00:00
he b17ac49bb1 Cast result of pthread__uc_pc() via intptr_t before using as a pointer.
Fixes compile problem for evbsh5.
2004-07-20 12:40:53 +00:00
chs 6c4049f2ff fix some stack-pointer math in the previous revision. 2004-07-20 01:51:49 +00:00