Commit Graph

421 Commits

Author SHA1 Message Date
christos
3ca3d0b1e7 add a missing volatile. 2007-01-20 04:56:07 +00:00
hubertf
55ac93d329 Remove more duplicate #includes, and a few spurious whitespaces at EOL
From Slava Semushin <slava.semushin@gmail.com>
2007-01-17 23:24:22 +00:00
ad
8e51dbdc7e For 1:1 threads: __strong_alias(__libc_thr_yield,_sys_sched_yield) 2007-01-16 07:09:17 +00:00
ad
b8daad9836 Fix a race between pthread_exit() and pthread_join(). 2007-01-16 05:22:55 +00:00
ad
efb1fc06e2 Fix a race between pthread_create() and pthread_exit() in the 1:1 case. 2007-01-16 04:19:02 +00:00
ad
39aa27f5ce Pass in the 'hint' argument when parking/unparking LWPs. 2007-01-16 01:35:16 +00:00
drochner
9c848e15d6 bring sched_yield() back which got lost recently 2007-01-08 20:54:42 +00:00
ad
ae979b2162 Add some items for 1:1 threads. 2006-12-25 11:36:36 +00:00
ad
ded2602507 Fix bugs with and improve upon previous. 2006-12-24 18:39:45 +00:00
ad
fe9718ac7c Add another comment. 2006-12-23 09:48:18 +00:00
ad
10058f19c8 Add a comment. 2006-12-23 05:18:56 +00:00
ad
1ac6a89b79 Conditionalised support for 1:1 threads. Needs associated kernel changes
and more work to be useful.
2006-12-23 05:14:46 +00:00
ad
11b0ba9c5d pthread__debuglog_printf(): check for linebuf == NULL. 2006-12-14 20:40:57 +00:00
ad
24ae41f8f3 Set _IOLBF on stdout. 2006-12-14 20:39:04 +00:00
christos
1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
yamt
41cc94b9f0 remove unused IDLESPINS. 2006-10-03 09:37:07 +00:00
wrstuden
25b0eaef3c Close a window in which we can not notice a recently-slept-on-our
mutex thread, thus leaving a thread sleeping on an unlocked mutex.

Reviewed by myself and Christos.

Problem reported by Arne H. Juul, arnej at pvv dot ntnu dot no,
in PR 26208. This fix represents option 1 presented in the PR.
2006-08-22 21:46:09 +00:00
ross
1a70c2f1e4 Err, restore the name of pthread__switch_return_point, it is
referenced from C code.
2006-07-09 01:07:38 +00:00
ross
a228aa3de2 Revise for LP64.
Encapsulate previously copied code sections into macros.
2006-07-08 05:09:44 +00:00
ross
032dc727f7 remove unreferenced temporary label 2006-07-08 05:04:49 +00:00
chuck
f4e3e7fe3b sigtimedwait: if we collect a queued signal via pt_siglist, do not
forget to clear it out of pt_siglist, otherwise we will keep getting
it over and over again.   fixes a problem introduced in rev 1.43.

problem observed with mysqld where sending it a SIGHUP after it has
set an alarm (e.g. due to some package like rt3 using it) caused the
signal handler thread to go into a tight loop (collecting a SIGALRM
[via sigwait() in mysqld.cc] that would not go away due to the above
issue).   mysqld appears to get a SIGHUP when /etc/rc exits, so it
can go into this tight loop after a reboot (but not if you restart
it by hand).   the bad sequence is:
	/etc/rc runs:
		- starts mysqld
		- starts web server with rt3 fastcgi starts
		- fastcgi/rt3 talks to mysqld (causing it to set an alarm)
		- /etc/rc exits, SIGHUP goes to mysqld
		- mysqld catches SIGHUP, signal handler thread gets
			stuck in loop (database continues to operate, slowly).

you can also trigger the problem by sending mysqld a SIGHUP by hand after
you've caused it to set an alarm by connecting to it.
2006-06-12 16:45:14 +00:00
snj
a640fe8c43 It's "its." 2006-04-24 19:00:29 +00:00
drochner
f782e99583 There is no point in using the internal sigprocmask() to initialize
the process' signal mask -- this ends up in a no-op.
Use the system call directly instead.
(This might be done in pthread_sig.c, but for now I wanted a simple
patch which is easily tested and pulled up.)
2006-04-24 18:39:36 +00:00
cube
562d0d89a2 Instead of using hard-coded values for various registers, get them from the
current context.  Valid values can change depending on how the kernel is
setup.  i386 and amd64 happen to be setup differently.
2006-03-29 22:55:15 +00:00
christos
142b3180cb Coverity CID 882: Avoid NULL deref. 2006-03-19 23:01:03 +00:00
yamt
9f9e6a32dd - do PTHREAD_MLOCK_KLUDGE in pthread__stackid_setup, rather than callers,
so that the main thread is not different from others.
  as a side effect, fix memory leak in pthread_create on error.
- make pthread__stackid_setup return a error rather than calling err(2).
2006-02-12 11:41:53 +00:00
skrll
2b3543128f I was a bit over zealous with my last change so revert the
locked_return_point change.

Loading the instruction at locked_return_point as a return value didn't
work so well.

Thanks to uwe, cube, and dsl.
2006-01-09 22:17:16 +00:00
kleink
5af00b0b39 pthread_sigmask(): Add restrict qualifier to set, oset args. 2006-01-07 20:10:29 +00:00
uwe
6b8eb49dd6 Use PLT for PIC calls to avoid text relocs in the shared library. 2006-01-06 22:46:14 +00:00
uwe
55ad9313a6 In PIC code call setcontext(2) via PLT to avoid text reloc in the
shared library.
2006-01-04 17:44:53 +00:00
skrll
73b7bdcee7 A couple of fixes to make libpthread really shared, i.e. not have text re-
locations:

	- Don't declare pthread__switch_away global
	- Do the PIC dance for pthread__switch_return_point and
	  pthread__locked_switch. Ideally these (and other) symbols would
	  be hidden.

Thanks to uwe@, dyoung@ and elad@ for help.

XXX sh3 is still to be done.
XXX vax does strange things.
2006-01-04 12:43:43 +00:00
uwe
ffaa72c2cc Adapt to new PIC macros that are now in <machine/asm.h>. Same binary
code is generated (still with text relocs, but eliminating them is the
next step).
2005-12-31 05:08:28 +00:00
perry
ce666bb8ce __asm__ -> __asm 2005-12-24 23:10:08 +00:00
perry
4e11af46bc Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 21:11:15 +00:00
christos
d7e5caf4fd include libc after our own files to fix ports that have 2 assym.h's. One
in pthread and one in libc.
2005-12-13 22:07:20 +00:00
chs
3ad2320789 if mlock() fails in pthread_create(), return EAGAIN instead of
failing an assertion.
2005-10-19 02:44:45 +00:00
chs
0e67554241 starting the pthread library (ie. calling pthread__start()) before
any threads are created turned out to be not such a good idea.
there are stronger requirements on what has to work in a forked child
while a process is still single-threaded.  so take all that stuff
back out and fix the problems with single-threaded programs that
are linked with libpthread differently, by checking if the library
has been started and doing completely different stuff if it hasn't been:
 - for pthread_rwlock_timedrdlock(), just fail with EDEADLK immediately.
 - for sem_wait(), the only thing that can unlock the semaphore is a
   signal handler, so use sigsuspend() to wait for a signal.
 - for pthread_mutex_lock_slow(), just go into an infinite loop
   waiting for signals.

I also noticed that there's a "sem2" test that has never worked in its
single-threaded form.  the problem there is that a signal handler tries
to take a sem_t interlock which is already held when the signal is received.
fix this too, by adding a single-threaded case for sig_trywait() that
blocks signals instead of using the userland interlock.
2005-10-19 02:15:03 +00:00
chs
ba70e96a09 in pthread_kill() and pthread_suspend_np(), return without doing anything
if the target thread is a zombie.

in all the functions that didn't do so already, verify a pthread_t before
dereferencing it (under #ifdef ERRORCHECK, since these checks are not
mandated by the standard).

clean up some debugging stuff.
2005-10-16 00:37:52 +00:00
chs
c190c7de90 fix the interaction between sigtimedwait() and pthread_kill(),
both waking up a sleeping thread and avoiding going to sleep if
a signal is already pending.  fixes PR 30348.
2005-10-16 00:31:35 +00:00
chs
2415c56ed0 in pthread_mutex_lock_slow(), pthread_rwlock_timedrdlock() and sem_wait(),
call pthread__start() if it hasn't already been called.  this avoids
an internal assertion from the library if these routines are used
before any threads are created and they need to sleep.
fixes PR 20256, PR 24241, PR 25722, PR 26096.
2005-10-16 00:07:24 +00:00
kleink
34ef731cb3 Change the sched_*() functions to return -1 and set errno to ENOSYS
(per the standard) instead of returning ENOSYS.  Noted by Ian Zagorskih
in PR kern/30970.
2005-10-09 11:17:28 +00:00
tv
21eb6bbacb pthread_attr_getschedpolicy() wasn't setting the return buffer at all.
SCHED_OTHER happens to be 0, so this assignment to "int *" succeeds,
and becomes a no-op.

Fix by dereferencing "policy" to do the assignment, thus filling the
return buffer with 0.
2005-09-21 15:27:14 +00:00
christos
f1cc481dfe XXX: Work around libpthread's "intimate" connection with libc. 2005-09-13 02:45:38 +00:00
christos
0393abcb27 Revert part of previous; we need to merge acts.sa_mask into our pthread mask.
Thanks martin...
2005-07-26 20:16:07 +00:00
christos
9d60b1fc89 - removed bogus acts.sa_mask setting.
- unblock the signal we are currently delivering, because it might have
  been blocked if we are woken up by another thread.
2005-07-26 20:11:02 +00:00
nathanw
0774992407 Add cancellation protection to pthread_once() as per the standard; if
the once routine is cancelled, the effect on once_control is as if
pthread_once() was never called.

Bug report and fix from PR lib/30734.
2005-07-16 23:14:53 +00:00
yamt
9493e4bf43 make this compile without PTHREAD_MLOCK_KLUDGE. 2005-07-01 12:35:18 +00:00
peter
d4cc3cce89 Create links for pthread_attr_setschedparam.3
and pthread_attr_getschedparam.3 to pthread_attr.3.

From Igor Sobrado in PR/29997.
2005-06-17 18:37:24 +00:00
wiz
52e496a68e New sentence, new line. 2005-06-17 18:26:53 +00:00
wiz
27d002e8de New sentence, new line.
Break much too long line.
2005-06-17 18:23:52 +00:00