Date: Tue, 5 Jan 2010 02:37:59 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src ObsoleteFiles.inc src/include Makefile semaphore.h src/lib/libc/gen Makefile.inc Symbol.map _pthread_stubs.c sem.c sem_new.c src/lib/libc/include libc_private.h src/lib/libthr pthread.map src/lib/libthr/thread Makefile.inc thr_init.c ... Message-ID: <201001050242.o052gdUV087927@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
davidxu 2010-01-05 02:37:59 UTC FreeBSD src repository Modified files: . ObsoleteFiles.inc include Makefile lib/libc/gen Makefile.inc Symbol.map _pthread_stubs.c sem.c lib/libc/include libc_private.h lib/libthr pthread.map lib/libthr/thread Makefile.inc thr_init.c thr_private.h thr_sem.c sys/kern uipc_sem.c sys/sys _semaphore.h Added files: include semaphore.h lib/libc/gen sem_new.c lib/libthr/thread thr_sem_new.c Removed files: sys/sys semaphore.h Log: SVN rev 201546 on 2010-01-05 02:37:59Z by davidxu Use umtx to implement process sharable semaphore, to make this work, now type sema_t is a structure which can be put in a shared memory area, and multiple processes can operate it concurrently. User can either use mmap(MAP_SHARED) + sem_init(pshared=1) or use sem_open() to initialize a shared semaphore. Named semaphore uses file system and is located in /tmp directory, and its file name is prefixed with 'SEMD', so now it is chroot or jail friendly. In simplist cases, both for named and un-named semaphore, userland code does not have to enter kernel to reduce/increase semaphore's count. The semaphore is designed to be crash-safe, it means even if an application is crashed in the middle of operating semaphore, the semaphore state is still safely recovered by later use, there is no waiter counter maintained by userland code. The main semaphore code is in libc and libthr only has some necessary stubs, this makes it possible that a non-threaded application can use semaphore without linking to thread library. Old semaphore implementation is kept libc to maintain binary compatibility. The kernel ksem API is no longer used in the new implemenation. Discussed on: threads@ Revision Changes Path 1.218 +2 -0 src/ObsoleteFiles.inc 1.293 +2 -2 src/include/Makefile 1.1 +64 -0 src/include/semaphore.h (new) 1.150 +1 -1 src/lib/libc/gen/Makefile.inc 1.25 +31 -20 src/lib/libc/gen/Symbol.map 1.17 +4 -0 src/lib/libc/gen/_pthread_stubs.c 1.17 +174 -58 src/lib/libc/gen/sem.c 1.1 +470 -0 src/lib/libc/gen/sem_new.c (new) 1.23 +2 -0 src/lib/libc/include/libc_private.h 1.32 +7 -14 src/lib/libthr/pthread.map 1.19 +1 -0 src/lib/libthr/thread/Makefile.inc 1.52 +3 -1 src/lib/libthr/thread/thr_init.c 1.97 +17 -0 src/lib/libthr/thread/thr_private.h 1.16 +40 -216 src/lib/libthr/thread/thr_sem.c 1.1 +103 -0 src/lib/libthr/thread/thr_sem_new.c (new) 1.38 +0 -1 src/sys/kern/uipc_sem.c 1.7 +2 -19 src/sys/sys/_semaphore.h 1.14 +0 -69 src/sys/sys/semaphore.h (dead)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001050242.o052gdUV087927>