Commit Graph

14 Commits

Author SHA1 Message Date
stefanf
ca175bacb2 Make __sem_timedwait() consistent with the sem_timedwait() prototype. 2005-10-18 17:24:03 +00:00
stefanf
bca82361aa Include <sys/types.h> and <limits.h> ourselves, don't assume they are included
through <pthread.h>.

gen/sem.c:		Prerequisite for <_semaphore.h>
net/getprotoent.c:	USHRT_MAX
net/getservent.c:	USHRT_MAX
stdio/ungetwc.c:	MB_LEN_MAX
stdio/vfwscanf.c:	MB_LEN_MAX
2005-08-20 07:59:13 +00:00
deischen
eb9a5c0d3b Prevent memory leak on sem_destroy() by destroying the semaphore's
internal mutex and CV.
2004-02-06 15:15:44 +00:00
deischen
f8f3e115d3 Only allow the semaphore to be taken when the value is positive.
Don't decrement it twice when it is taken.

Reported by:	kris
2004-02-06 13:54:38 +00:00
deischen
d87ac0c325 Correct check for invalid semaphore on sem_destroy() (s/==/!=/).
Reported by:	kris
2004-02-05 23:32:45 +00:00
deischen
5d21c38b89 Correct the weak reference for sem_unlink. 2004-02-05 22:36:27 +00:00
deischen
08158a6ba7 Allow libc's version of sem_trywait() to work for non-pshared mutexes. 2004-02-04 15:37:48 +00:00
deischen
5be959edb7 Modify the implementation of libc semaphores so that they can be
overridden by the threads library to provide a userland version
of non-pshared semaphores and cancellation points.  Also add
a sem_timedwait().

The libc version of semaphores always uses kernel semaphores
regardless of whether pshared is set or not.  When threads are
not present, it is difficult to get sem_wait() or sem_timedwait()
to do the right thing (since pthread_cond_timedwait() and
pthread_cond_wait() are stubs in libc and just return immediately).
2004-02-03 05:47:19 +00:00
davidxu
cfbecaf585 Backout revision 1.6, because some stub functions not in libc, and
non-threaded won't build. The cancellation point support should be
further discussed.
2004-01-17 07:15:06 +00:00
davidxu
f9aac56ad7 Enable cancellation point in sem_wait, it is required by POSIX.
For pshared semaphore, this commit still does not enable cancellation
point, I think there should be a pthread_enter_cancellation_point_np
for libc to implement a safe cancellation point.
2004-01-17 02:45:37 +00:00
nectar
832e8b7f9a Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by:	/sbin/md5
2003-02-16 17:29:11 +00:00
tjr
fc5f7e9a8b Add the newly created semaphore to the named semaphore list in sem_open()
so that multiple opens of the same semaphore without an intervening
sem_close() return the same object, and so that sem_close() does not
segfault while trying to remove the item from the list.
2003-01-14 03:36:45 +00:00
mike
cf479e3516 Add restrict type-qualifier to sem_getvalue(). 2002-10-04 21:32:00 +00:00
alfred
d5e93c10ec Welcome the sem_ API to libc! 2002-09-19 01:14:08 +00:00