Commit Graph

433 Commits

Author SHA1 Message Date
ad 3247035dcc Cast the return value of _lwp_unpark_all(), just in case. 2007-02-09 23:53:24 +00:00
ad a21c37097e Bump libpthread & libpthread_dbg minor versions so that an old SA copy
gets kept in the file system. Requested by pavel.
2007-02-09 23:00:16 +00:00
ad 401499f30e Sync with kernel changes introduced by merging the newlock2 branch. 2007-02-09 22:08:48 +00:00
ad d333bb5f2f Build without sys/sa.h present. 2007-02-06 15:24:37 +00:00
christos 858097f9a1 use __func__ instead of __FUNCTION__ which is a gcc extension. 2007-01-31 23:55:20 +00:00
christos bbc680871a Add another volatile, mentioned in current-users from a cross-build on amd64. 2007-01-22 15:06:31 +00:00
ad 7630e3876c pthread_create(): clear newthread->pt_sleeponq before calling _lwp_create(). 2007-01-20 20:02:36 +00:00
christos 1eb6e5fbb2 add casts to pacify lint. 2007-01-20 18:58:11 +00:00
christos 25a0745d2e remove unused variable/code. 2007-01-20 18:57:41 +00:00
christos d1ddfe10b1 fix warning about indirect call without * 2007-01-20 18:56:30 +00:00
christos b4634d8561 sprinkle volatile. 2007-01-20 18:00:15 +00:00
christos 1636e22df7 set warns to 4 2007-01-20 04:56:25 +00:00
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