Compare commits
No commits in common. "main" and "freebsd" have entirely different histories.
12 changed files with 92 additions and 128 deletions
65
Makefile
65
Makefile
|
@ -1,40 +1,41 @@
|
|||
LIB= stdthreads
|
||||
PACKAGE_VERSION?= 0.3.2
|
||||
PREFIX?= /usr
|
||||
# $FreeBSD$
|
||||
|
||||
HDR= threads.h
|
||||
PACKAGE=lib${LIB}
|
||||
LIB= stdthreads
|
||||
SHLIB_MAJOR= 0
|
||||
|
||||
INCS= threads.h
|
||||
SRCS= threads.h call_once.c cnd.c mtx.c thrd.c tss.c
|
||||
|
||||
MAN= thrd_create.3
|
||||
MLINKS= thrd_create.3 call_once.3 \
|
||||
thrd_create.3 cnd_broadcast.3 \
|
||||
thrd_create.3 cnd_destroy.3 \
|
||||
thrd_create.3 cnd_init.3 \
|
||||
thrd_create.3 cnd_signal.3 \
|
||||
thrd_create.3 cnd_timedwait.3 \
|
||||
thrd_create.3 cnd_wait.3 \
|
||||
thrd_create.3 mtx_destroy.3 \
|
||||
thrd_create.3 mtx_init.3 \
|
||||
thrd_create.3 mtx_lock.3 \
|
||||
thrd_create.3 mtx_timedlock.3 \
|
||||
thrd_create.3 mtx_trylock.3 \
|
||||
thrd_create.3 mtx_unlock.3 \
|
||||
thrd_create.3 thrd_current.3 \
|
||||
thrd_create.3 thrd_detach.3 \
|
||||
thrd_create.3 thrd_equal.3 \
|
||||
thrd_create.3 thrd_exit.3 \
|
||||
thrd_create.3 thrd_join.3 \
|
||||
thrd_create.3 thrd_sleep.3 \
|
||||
thrd_create.3 thrd_yield.3 \
|
||||
thrd_create.3 tss_create.3 \
|
||||
thrd_create.3 tss_delete.3 \
|
||||
thrd_create.3 tss_get.3 \
|
||||
thrd_create.3 tss_set.3
|
||||
|
||||
CPPFLAGS+= -Wno-incompatible-pointer-types-discards-qualifiers
|
||||
LDADD= -L${BSDOBJDIR}/lib/librthread -lpthread
|
||||
LIBADD= pthread
|
||||
|
||||
VERSION_SCRIPT= ${.CURDIR}/Symbol.map
|
||||
|
||||
includes:
|
||||
@cd ${.CURDIR}; j="cmp -s ${HDR} ${DESTDIR}/usr/include/${HDR} || \
|
||||
${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
|
||||
-m 444 ${HDR} ${DESTDIR}/usr/include"; \
|
||||
echo $$j; \
|
||||
eval "$$j"; \
|
||||
|
||||
stdthreads.pc: stdthreads.pc.in
|
||||
@sed -e 's#@prefix@#${PREFIX}#g' \
|
||||
-e 's#@exec_prefix@#$${prefix}#g' \
|
||||
-e 's#@libdir@#$${exec_prefix}/lib#g' \
|
||||
-e 's#@includedir@#$${prefix}/include#g' \
|
||||
-e 's#@PACKAGE_VERSION@#'${PACKAGE_VERSION}'#g' \
|
||||
< ${.CURDIR}/stdthreads.pc.in > $@
|
||||
|
||||
all: stdthreads.pc
|
||||
|
||||
CLEANFILES+= stdthreads.pc
|
||||
|
||||
install-pc: stdthreads.pc
|
||||
${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
|
||||
stdthreads.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
||||
|
||||
realinstall: install-pc
|
||||
VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def
|
||||
SYMBOL_MAPS= ${.CURDIR}/Symbol.map
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
|
17
Makefile.depend
Normal file
17
Makefile.depend
Normal file
|
@ -0,0 +1,17 @@
|
|||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
59
Symbol.map
59
Symbol.map
|
@ -1,30 +1,31 @@
|
|||
{
|
||||
global:
|
||||
call_once;
|
||||
cnd_broadcast;
|
||||
cnd_destroy;
|
||||
cnd_init;
|
||||
cnd_signal;
|
||||
cnd_timedwait;
|
||||
cnd_wait;
|
||||
mtx_destroy;
|
||||
mtx_init;
|
||||
mtx_lock;
|
||||
mtx_timedlock;
|
||||
mtx_trylock;
|
||||
mtx_unlock;
|
||||
thrd_create;
|
||||
thrd_current;
|
||||
thrd_detach;
|
||||
thrd_equal;
|
||||
thrd_exit;
|
||||
thrd_join;
|
||||
thrd_sleep;
|
||||
thrd_yield;
|
||||
tss_create;
|
||||
tss_delete;
|
||||
tss_get;
|
||||
tss_set;
|
||||
local:
|
||||
*;
|
||||
/*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
FBSD_1.3 {
|
||||
call_once;
|
||||
cnd_broadcast;
|
||||
cnd_destroy;
|
||||
cnd_init;
|
||||
cnd_signal;
|
||||
cnd_timedwait;
|
||||
cnd_wait;
|
||||
mtx_destroy;
|
||||
mtx_init;
|
||||
mtx_lock;
|
||||
mtx_timedlock;
|
||||
mtx_trylock;
|
||||
mtx_unlock;
|
||||
thrd_create;
|
||||
thrd_current;
|
||||
thrd_detach;
|
||||
thrd_equal;
|
||||
thrd_exit;
|
||||
thrd_join;
|
||||
thrd_sleep;
|
||||
thrd_yield;
|
||||
tss_create;
|
||||
tss_delete;
|
||||
tss_get;
|
||||
tss_set;
|
||||
};
|
||||
|
|
|
@ -25,9 +25,11 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
|
2
cnd.c
2
cnd.c
|
@ -25,9 +25,11 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
|
2
mtx.c
2
mtx.c
|
@ -25,9 +25,11 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
major=0
|
||||
minor=0
|
|
@ -1,11 +0,0 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: stdthreads
|
||||
Description: The C11 standard threads library
|
||||
Version: @PACKAGE_VERSION@
|
||||
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lstdthreads -lpthread
|
2
thrd.c
2
thrd.c
|
@ -25,9 +25,11 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 26, 2011
|
||||
.Dt THRD_CREATE 3
|
||||
.Os
|
||||
|
|
54
threads.h
54
threads.h
|
@ -33,60 +33,6 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
* Lock annotations.
|
||||
*
|
||||
* Clang provides support for doing basic thread-safety tests at
|
||||
* compile-time, by marking which locks will/should be held when
|
||||
* entering/leaving a functions.
|
||||
*
|
||||
* Furthermore, it is also possible to annotate variables and structure
|
||||
* members to enforce that they are only accessed when certain locks are
|
||||
* held.
|
||||
*/
|
||||
|
||||
#if __has_extension(c_thread_safety_attributes)
|
||||
#define __lock_annotate(x) __attribute__((x))
|
||||
#else
|
||||
#define __lock_annotate(x)
|
||||
#endif
|
||||
|
||||
/* Structure implements a lock. */
|
||||
#define __lockable __lock_annotate(lockable)
|
||||
|
||||
/* Function acquires an exclusive or shared lock. */
|
||||
#define __locks_exclusive(...) \
|
||||
__lock_annotate(exclusive_lock_function(__VA_ARGS__))
|
||||
#define __locks_shared(...) \
|
||||
__lock_annotate(shared_lock_function(__VA_ARGS__))
|
||||
|
||||
/* Function attempts to acquire an exclusive or shared lock. */
|
||||
#define __trylocks_exclusive(...) \
|
||||
__lock_annotate(exclusive_trylock_function(__VA_ARGS__))
|
||||
#define __trylocks_shared(...) \
|
||||
__lock_annotate(shared_trylock_function(__VA_ARGS__))
|
||||
|
||||
/* Function releases a lock. */
|
||||
#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__))
|
||||
|
||||
/* Function asserts that an exclusive or shared lock is held. */
|
||||
#define __asserts_exclusive(...) \
|
||||
__lock_annotate(assert_exclusive_lock(__VA_ARGS__))
|
||||
#define __asserts_shared(...) \
|
||||
__lock_annotate(assert_shared_lock(__VA_ARGS__))
|
||||
|
||||
|
||||
/* Function requires that an exclusive or shared lock is or is not held. */
|
||||
#define __requires_exclusive(...) \
|
||||
__lock_annotate(exclusive_locks_required(__VA_ARGS__))
|
||||
#define __requires_shared(...) \
|
||||
__lock_annotate(shared_locks_required(__VA_ARGS__))
|
||||
#define __requires_unlocked(...) \
|
||||
__lock_annotate(locks_excluded(__VA_ARGS__))
|
||||
|
||||
/* Function should not be analyzed. */
|
||||
#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
|
||||
|
||||
/*
|
||||
* The C11 threads interface.
|
||||
*
|
||||
|
|
2
tss.c
2
tss.c
|
@ -25,9 +25,11 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue