summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread
Commit message (Collapse)AuthorAgeFilesLines
* Update the caller's descriptor masks even if there are none ready forJohn Birrell1998-06-121-1/+1
| | | | | | | | I/O for those applications that don't believe the return value of zero as meaning that THERE ARE *NO* DESCRIPTORS READY. Notes: svn path=/head/; revision=36904
* Check the access mode in the flags before waiting on a read or a writeJohn Birrell1998-06-104-4/+52
| | | | | | | | that might never be possible if the file was not opened in the corrent mode. This prevents a hang for bad programs. Why do people code like that? Notes: svn path=/head/; revision=36877
* Remove SA_RESTART from the signal dispatch in user-space since thisJohn Birrell1998-06-101-92/+39
| | | | | | | seems to be tripping up a lot of applications. Notes: svn path=/head/; revision=36876
* When doing a F_SETFL, read the flags back so that the ones storedJohn Birrell1998-06-101-3/+31
| | | | | | | | in the file descriptor table are exactly what the kernel knows subject to the O_NONBLOCK flag being requested by the user. Notes: svn path=/head/; revision=36875
* Implement compile time debug support instead of tracking file name andJohn Birrell1998-06-0913-87/+94
| | | | | | | | | | line number every time a file descriptor is locked. This looks like a big change but it isn't. It should reduce the size of libc_r and make it run slightly faster. Notes: svn path=/head/; revision=36830
* Add support for compile time debug. This is enabled if libc_r is builtJohn Birrell1998-06-091-20/+52
| | | | | | | | | | | | | with -D_LOCK_DEBUG. This adds the file name and line number to each lock call and these are stored in the spinlock structure. When using debug mode, the lock function will check if the thread is trying to lock something it has already locked. This is not supposed to happen because the lock will be freed too early. Without lock debug, libc_r should be smaller and slightly faster. Notes: svn path=/head/; revision=36828
* POSIX says that pthread_exit() is not allowed to be called from aJohn Birrell1998-06-091-0/+10
| | | | | | | | | | | cleanup destructor, so trap this case to prevent me from being being burnt again by applications that try to do this. With this change, an application (like one using a mis-configured ACE) will exit the process after displaying a message quoting the POSIX section that the application has violated. Notes: svn path=/head/; revision=36827
* Add compile time thread lock debug support.John Birrell1998-06-091-6/+21
| | | | | | | | Add a thread specific flag to trap the case where pthread_exit() is called from a destructor in violation of the Posix standard. Notes: svn path=/head/; revision=36826
* Add a warning message for a thread locking against itself. This isJohn Birrell1998-06-061-3/+14
| | | | | | | | not supposed to happen, but I have seen bogus g++ code that causes it. Notes: svn path=/head/; revision=36698
* Simplify the handling of thread specific data. Only track if a keyJohn Birrell1998-06-061-45/+33
| | | | | | | | | is allocated or not, rather than keeping a count and attempting to know it it is in-use. POSIX says that once a key is deleted, using the key again results in undefined behaviour. Notes: svn path=/head/; revision=36697
* Re-design the thread specific key structure.John Birrell1998-06-061-3/+2
| | | | Notes: svn path=/head/; revision=36696
* I got the last commit back to front.John Birrell1998-06-061-3/+3
| | | | Notes: svn path=/head/; revision=36694
* Fix the signal behaviour for internal states which set the threadJohn Birrell1998-06-051-6/+51
| | | | | | | | state to running despite the SA_RESTART flag which is really just for syscalls. Notes: svn path=/head/; revision=36680
* I shouldn't do things early in the morning.John Birrell1998-06-011-3/+1
| | | | | | | | | I shouldn't do things early in the morning. [...] I shouldn't do things early in the morning. Notes: svn path=/head/; revision=36553
* Add some missing syscall wrappers.John Birrell1998-05-311-1/+5
| | | | Notes: svn path=/head/; revision=36550
* Remove some stale code.John Birrell1998-05-311-1/+1
| | | | | | | Pointed out by: Amancio Notes: svn path=/head/; revision=36549
* Don't restart a syscall when a SIGCHLD is received by a thread waitingJohn Birrell1998-05-311-1/+6
| | | | | | | on a child process. Notes: svn path=/head/; revision=36548
* Make a copy of the caller's iovec array, mallocing if necessary,John Birrell1998-05-271-14/+62
| | | | | | | | and modify that if the writev() syscall does not completely write all bytes in a single call. Notes: svn path=/head/; revision=36402
* When doing a blocking write, keep looping until all the bytes areJohn Birrell1998-05-252-20/+106
| | | | | | | | | | written without returning to the caller. This only occurs on pipes where either the number of bytes written is greater than the pipe buffer or if there is insufficient space in the pipe buffer because the reader is reading slower than the writer is writing. Notes: svn path=/head/; revision=36382
* Treat the lock value as volatile.John Birrell1998-05-051-2/+2
| | | | Notes: svn path=/head/; revision=35754
* Cleanup in the child, not the parent.John Birrell1998-05-021-2/+2
| | | | | | | Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no> Notes: svn path=/head/; revision=35614
* Fix the incremental priority increment.John Birrell1998-04-301-2/+2
| | | | | | | PR: bin/6467 Marino Ladavac <lada@pc8811.gud.siemens.at> Notes: svn path=/head/; revision=35564
* Change signal model to match POSIX (i.e. one set of signal handlersJohn Birrell1998-04-2938-1224/+865
| | | | | | | | | | | | | | | | | | | | | | | for the process, not a separate set for each thread). By default, the process now only has signal handlers installed for SIGVTALRM, SIGINFO and SIGCHLD. The thread kernel signal handler is installed for other signals on demand. This means that SIG_IGN and SIG_DFL processing is now left to the kernel, not the thread kernel. Change the signal dispatch to no longer use a signal thread, and call the signal handler using the stack of the thread that has the signal pending. Change the atomic lock method to use test-and-set asm code with a yield if blocked. This introduces separate locks for each type of object instead of blocking signals to prevent a context switch. It was this blocking of signals that caused the performance degradation the people have noted. This is a *big* change! Notes: svn path=/head/; revision=35509
* Allow a thread dump to report the thread's sigmask when in theJohn Birrell1998-04-171-0/+4
| | | | | | | PS_SIGWAIT state. Notes: svn path=/head/; revision=35247
* When in PS_SIGWAIT state, still call signal handlers and set errnoJohn Birrell1998-04-171-13/+2
| | | | | | | to EINTR. Notes: svn path=/head/; revision=35246
* Change the FILE locking to be by FILE, not by the underlying fd asJohn Birrell1998-04-114-11/+39
| | | | | | | | | | | | | | | | it was. Add a FILE_WAIT state and queue threads waiting for a FILE lock. Start using the sys/queue.h macros instead of the way that MIT pthreads did it. Add a thread name to the private thread structure and a non-POSIX function to set this. This helps (me at least) when sending a SIGINFO to a threaded process to get a /tmp/uthread.dump to see what the <expletive deleted> threads are doing this time. It is nice to be able to recognise (yes, I spell that with an 's' too) which threads are which. Notes: svn path=/head/; revision=35130
* Enable static initialisation of mutexes and condition variables.John Birrell1998-04-042-8/+32
| | | | Notes: svn path=/head/; revision=35027
* Rename static initializer defines for opaque structures so that theJohn Birrell1998-04-041-2/+2
| | | | | | | POSIX specified names can be declared in pthread.h. Notes: svn path=/head/; revision=35024
* Move the magic field initialisation to a place when it is more magic.John Birrell1998-04-041-6/+7
| | | | Notes: svn path=/head/; revision=35022
* Add a magic field to the pthread structure to help recognize validJohn Birrell1998-04-034-2/+25
| | | | | | | | | | | | | | | | | 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! Notes: svn path=/head/; revision=35008
* Fix a problem of indirection unblocking signals that would have causedJohn Birrell1998-03-221-1/+1
| | | | | | | | | | signals to be unblocked even if they were already blocked when entering the function. Pointed out by: bde Notes: svn path=/head/; revision=34772
* When forking a process, only the running thread gets to live. AllJohn Birrell1998-03-091-0/+39
| | | | | | | | other threads never see the light of day and if they leave things locked, blame POSIX. Notes: svn path=/head/; revision=34381
* Add FreeBSD/Alpha code to initialise a jmpbuf for a created thread.John Birrell1998-03-092-7/+23
| | | | | | | Change a bunch of __alpha references to __alpha__. Notes: svn path=/head/; revision=34362
* Add sched_yield() witch is the draft 10 equivalent of pthread_yield()John Birrell1998-03-082-22/+22
| | | | | | | | from draft 4. Move some of the schedule definitions to sched.h which is a POSIX header. Notes: svn path=/head/; revision=34224
* Fixes from Jeremy Allison and Terry Lambert for pthreads:Julian Elischer1998-02-135-9/+96
| | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=33292
* Changed pthread_detach to conform to POSIX, i.e. the single argumentAlexander Langer1997-12-251-10/+3
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=31985
* Modify the return values to comply with POSIX. Previously theseAlexander Langer1997-11-259-77/+38
| | | | | | | | | 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. Notes: svn path=/head/; revision=31402
* Added missing source file uthread_sigwait.c.Alexander Langer1997-11-241-1/+2
| | | | | | | Submitted by: Daniel M. Eischen <deischen@iworks.InterWorks.org> Notes: svn path=/head/; revision=31400
* Correct the return value from pthread_cond_timedwait when a timeoutAlexander Langer1997-11-231-1/+1
| | | | | | | | | occurs (was EAGAIN, is now ETIMEDOUT). Submitted by: Daniel M. Eischen <deischen@iworks.InterWorks.org> Notes: svn path=/head/; revision=31375
* Bring back nanosleep from the cold.John Birrell1997-06-041-1/+1
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=26445
* Fixed overallocation of _thread_fd_table.Alexander Langer1997-05-131-1/+1
| | | | | | | | PR: 3494 Submitted by: Steve Bauer <sbauer@rock.sdsmt.edu> Notes: svn path=/head/; revision=25795
* Add const in the thread version of nanosleep()'s argsPeter Wemm1997-05-121-1/+2
| | | | Notes: svn path=/head/; revision=25738
* remove prototype for nanosleep(), it's visible in unistd.h now.Peter Wemm1997-05-121-1/+0
| | | | Notes: svn path=/head/; revision=25737
* Bye bye CPLUSPLUSLIB hack! It's not needed any more.John Polstra1997-05-061-3/+1
| | | | | | | | 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. Notes: svn path=/head/; revision=25501
* Use libc makefiles from now on instead of duplicating them in libc_r.John Birrell1997-05-031-0/+3
| | | | | | | Added Id strings too. It's useful to know who last made a change. Notes: svn path=/head/; revision=25402
* Set wakeup time in pthread_cond_wait() to `forever' (-1) to preventJohn Birrell1997-04-111-24/+41
| | | | | | | | | | calling thread from being rescheduled based on an unspecified wakeup time. Bug/fix pointed out by Alexandre Fenyo <fenyo@email.enst.fr>. Notes: svn path=/head/; revision=24827
* Fix indentations. Sigh.John Birrell1997-04-011-15/+17
| | | | Notes: svn path=/head/; revision=24520
* Add parentheses to make blocking mode work.John Birrell1997-04-014-4/+12
| | | | Notes: svn path=/head/; revision=24518
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22993
* Submitted by: John BirrellJulian Elischer1997-02-0539-162/+994
| | | | | | | uthreads update from the author. Notes: svn path=/head/; revision=22315