newlib: Implemented recursive mutexes
- Implemented recursive mutexes; - Implemented spin locks; - Implemented pthread_detach() - Fixed getting main TID; - Use flag for thread slots to fit slots into memory page; - Fixed conflict: replace type to kind. Signed-off-by: Max Logaev <maxlogaev@proton.me>
This commit is contained in:
@@ -657,15 +657,18 @@ check_PROGRAMS =
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/dbg.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_internal.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_mutex.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_mutex_impl.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_mutex_init.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_mutex_normal.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_mutex_recursive.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_mutexattr.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_free_stk_exit.S \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_create.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_thread_entry.S \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_equal.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_exit.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_detach.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_join.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_self.c
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_self.c \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/pthread_spinlock.c
|
||||
@HAVE_LIBC_MACHINE_AARCH64_TRUE@am__append_66 = \
|
||||
@HAVE_LIBC_MACHINE_AARCH64_TRUE@ libc/machine/aarch64/memchr-stub.c \
|
||||
@HAVE_LIBC_MACHINE_AARCH64_TRUE@ libc/machine/aarch64/memchr.S \
|
||||
@@ -1974,15 +1977,18 @@ am__objects_51 = libc/ssp/libc_a-chk_fail.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/libc_a-dbg.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_internal.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_mutex.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_mutexattr.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_free_stk_exit.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_create.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_thread_entry.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_equal.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_exit.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_detach.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_join.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_self.$(OBJEXT)
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_self.$(OBJEXT) \
|
||||
@HAVE_LIBC_SYS_KOLIBRIOS_DIR_TRUE@ libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.$(OBJEXT)
|
||||
@HAVE_LIBC_MACHINE_AARCH64_TRUE@am__objects_77 = libc/machine/aarch64/libc_a-memchr-stub.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_AARCH64_TRUE@ libc/machine/aarch64/libc_a-memchr.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_AARCH64_TRUE@ libc/machine/aarch64/libc_a-memcmp-stub.$(OBJEXT) \
|
||||
@@ -8263,7 +8269,13 @@ libc/sys/kolibrios/pthread/libc_a-pthread_internal.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutexattr.$(OBJEXT): \
|
||||
@@ -8281,7 +8293,7 @@ libc/sys/kolibrios/pthread/libc_a-pthread_thread_entry.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_equal.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_exit.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_detach.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_join.$(OBJEXT): \
|
||||
@@ -8290,6 +8302,9 @@ libc/sys/kolibrios/pthread/libc_a-pthread_join.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_self.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.$(OBJEXT): \
|
||||
libc/sys/kolibrios/pthread/$(am__dirstamp) \
|
||||
libc/sys/kolibrios/pthread/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/machine/aarch64/$(am__dirstamp):
|
||||
@$(MKDIR_P) libc/machine/aarch64
|
||||
@: > libc/machine/aarch64/$(am__dirstamp)
|
||||
@@ -14187,15 +14202,18 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/$(DEPDIR)/libc_a-wait.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/$(DEPDIR)/libc_a-write.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_create.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_detach.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_equal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_exit.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_free_stk_exit.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_internal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_join.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_impl.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_init.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_normal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_recursive.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutexattr.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_self.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_spinlock.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_thread_entry.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/m88kbug/$(DEPDIR)/libc_a-syscalls.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/sys/mmixware/$(DEPDIR)/libc_a-_exit.Po@am__quote@
|
||||
@@ -34026,19 +34044,47 @@ libc/sys/kolibrios/pthread/libc_a-pthread_mutex.obj: libc/sys/kolibrios/pthread/
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex.c'; fi`
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.o: libc/sys/kolibrios/pthread/pthread_mutex_impl.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_impl.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_impl.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_impl.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_impl.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_impl.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_impl.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.o' libtool=no @AMDEPBACKSLASH@
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.o: libc/sys/kolibrios/pthread/pthread_mutex_init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_init.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_init.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_init.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_init.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_init.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_impl.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_impl.c
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_init.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_init.c
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.obj: libc/sys/kolibrios/pthread/pthread_mutex_impl.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.obj -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_impl.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_impl.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_impl.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_impl.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_impl.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_impl.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_impl.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.obj' libtool=no @AMDEPBACKSLASH@
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.obj: libc/sys/kolibrios/pthread/pthread_mutex_init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.obj -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_init.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_init.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_init.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_init.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_init.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_init.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_init.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_impl.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_impl.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_impl.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_impl.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_init.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_init.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_init.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_init.c'; fi`
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.o: libc/sys/kolibrios/pthread/pthread_mutex_normal.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_normal.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_normal.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_normal.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_normal.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_normal.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_normal.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_normal.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_normal.c
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.obj: libc/sys/kolibrios/pthread/pthread_mutex_normal.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.obj -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_normal.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_normal.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_normal.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_normal.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_normal.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_normal.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_normal.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_normal.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_normal.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_normal.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_normal.c'; fi`
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.o: libc/sys/kolibrios/pthread/pthread_mutex_recursive.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_recursive.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_recursive.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_recursive.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_recursive.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_recursive.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_recursive.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutex_recursive.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutex_recursive.c
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.obj: libc/sys/kolibrios/pthread/pthread_mutex_recursive.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.obj -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_recursive.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_recursive.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_recursive.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_recursive.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_recursive.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutex_recursive.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_mutex_recursive.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutex_recursive.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_mutex_recursive.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_mutex_recursive.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_mutex_recursive.c'; fi`
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_mutexattr.o: libc/sys/kolibrios/pthread/pthread_mutexattr.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_mutexattr.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_mutexattr.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_mutexattr.o `test -f 'libc/sys/kolibrios/pthread/pthread_mutexattr.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_mutexattr.c
|
||||
@@ -34082,19 +34128,19 @@ libc/sys/kolibrios/pthread/libc_a-pthread_equal.obj: libc/sys/kolibrios/pthread/
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_equal.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_equal.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_equal.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_equal.c'; fi`
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_exit.o: libc/sys/kolibrios/pthread/pthread_exit.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_exit.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_exit.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_exit.o `test -f 'libc/sys/kolibrios/pthread/pthread_exit.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_exit.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_exit.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_exit.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_exit.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_exit.o' libtool=no @AMDEPBACKSLASH@
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_detach.o: libc/sys/kolibrios/pthread/pthread_detach.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_detach.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_detach.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_detach.o `test -f 'libc/sys/kolibrios/pthread/pthread_detach.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_detach.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_detach.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_detach.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_detach.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_detach.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_exit.o `test -f 'libc/sys/kolibrios/pthread/pthread_exit.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_exit.c
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_detach.o `test -f 'libc/sys/kolibrios/pthread/pthread_detach.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_detach.c
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_exit.obj: libc/sys/kolibrios/pthread/pthread_exit.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_exit.obj -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_exit.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_exit.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_exit.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_exit.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_exit.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_exit.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_exit.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_exit.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_exit.obj' libtool=no @AMDEPBACKSLASH@
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_detach.obj: libc/sys/kolibrios/pthread/pthread_detach.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_detach.obj -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_detach.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_detach.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_detach.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_detach.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_detach.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_detach.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_detach.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_detach.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_detach.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_exit.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_exit.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_exit.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_exit.c'; fi`
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_detach.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_detach.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_detach.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_detach.c'; fi`
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_join.o: libc/sys/kolibrios/pthread/pthread_join.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_join.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_join.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_join.o `test -f 'libc/sys/kolibrios/pthread/pthread_join.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_join.c
|
||||
@@ -34124,6 +34170,20 @@ libc/sys/kolibrios/pthread/libc_a-pthread_self.obj: libc/sys/kolibrios/pthread/p
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_self.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_self.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_self.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_self.c'; fi`
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.o: libc/sys/kolibrios/pthread/pthread_spinlock.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.o -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_spinlock.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.o `test -f 'libc/sys/kolibrios/pthread/pthread_spinlock.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_spinlock.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_spinlock.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_spinlock.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_spinlock.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.o `test -f 'libc/sys/kolibrios/pthread/pthread_spinlock.c' || echo '$(srcdir)/'`libc/sys/kolibrios/pthread/pthread_spinlock.c
|
||||
|
||||
libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.obj: libc/sys/kolibrios/pthread/pthread_spinlock.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.obj -MD -MP -MF libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_spinlock.Tpo -c -o libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_spinlock.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_spinlock.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_spinlock.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_spinlock.Tpo libc/sys/kolibrios/pthread/$(DEPDIR)/libc_a-pthread_spinlock.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/sys/kolibrios/pthread/pthread_spinlock.c' object='libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/sys/kolibrios/pthread/libc_a-pthread_spinlock.obj `if test -f 'libc/sys/kolibrios/pthread/pthread_spinlock.c'; then $(CYGPATH_W) 'libc/sys/kolibrios/pthread/pthread_spinlock.c'; else $(CYGPATH_W) '$(srcdir)/libc/sys/kolibrios/pthread/pthread_spinlock.c'; fi`
|
||||
|
||||
libc/machine/aarch64/libc_a-memchr-stub.o: libc/machine/aarch64/memchr-stub.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/machine/aarch64/libc_a-memchr-stub.o -MD -MP -MF libc/machine/aarch64/$(DEPDIR)/libc_a-memchr-stub.Tpo -c -o libc/machine/aarch64/libc_a-memchr-stub.o `test -f 'libc/machine/aarch64/memchr-stub.c' || echo '$(srcdir)/'`libc/machine/aarch64/memchr-stub.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/machine/aarch64/$(DEPDIR)/libc_a-memchr-stub.Tpo libc/machine/aarch64/$(DEPDIR)/libc_a-memchr-stub.Po
|
||||
|
||||
@@ -351,7 +351,7 @@ extern "C"
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#define KSYS_GET_FROM_BUF(type, buf, offset) \
|
||||
#define _KSYS_GET_FROM_BUF(type, buf, offset) \
|
||||
(*((type *)((uint8_t *)(buf) + (offset))))
|
||||
|
||||
static inline long
|
||||
|
||||
@@ -439,6 +439,7 @@ extern "C" {
|
||||
#ifdef __KOLIBRIOS__
|
||||
#define _POSIX_THREADS 1
|
||||
#define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1
|
||||
#define _POSIX_SPIN_LOCKS 200809L
|
||||
#endif /* __KOLIBRIOS__ */
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
|
||||
@@ -31,12 +31,15 @@ libc_a_SOURCES += \
|
||||
libc_a_SOURCES += \
|
||||
%D%/pthread/pthread_internal.c \
|
||||
%D%/pthread/pthread_mutex.c \
|
||||
%D%/pthread/pthread_mutex_impl.c \
|
||||
%D%/pthread/pthread_mutex_init.c \
|
||||
%D%/pthread/pthread_mutex_normal.c \
|
||||
%D%/pthread/pthread_mutex_recursive.c \
|
||||
%D%/pthread/pthread_mutexattr.c \
|
||||
%D%/pthread/pthread_free_stk_exit.S \
|
||||
%D%/pthread/pthread_create.c \
|
||||
%D%/pthread/pthread_thread_entry.S \
|
||||
%D%/pthread/pthread_equal.c \
|
||||
%D%/pthread/pthread_exit.c \
|
||||
%D%/pthread/pthread_detach.c \
|
||||
%D%/pthread/pthread_join.c \
|
||||
%D%/pthread/pthread_self.c
|
||||
%D%/pthread/pthread_self.c \
|
||||
%D%/pthread/pthread_spinlock.c
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
#include <_syslist.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#include "pthread/pthread_internal.h"
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
void
|
||||
_exit (int rc)
|
||||
{
|
||||
__pthread_fini();
|
||||
_ksys (SF_TERMINATE_PROCESS);
|
||||
__builtin_unreachable ();
|
||||
__pthread_fini_and_exit();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <kolibrios/app.h>
|
||||
|
||||
#include "pthread/pthread_internal.h"
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
extern void __init_reent (void);
|
||||
extern int main (int argc, char *argv[], char *envp[]);
|
||||
|
||||
@@ -16,12 +16,13 @@ Fully implemented:
|
||||
- `pthread_equal()`
|
||||
- `pthread_self()`
|
||||
- `pthread_join()`
|
||||
- `pthread_detach()`
|
||||
|
||||
Implemented with restrictions:
|
||||
|
||||
- `pthread_create()`: attributes are not supported;
|
||||
|
||||
`PTHREAD_MUTEX_RECURSIVE` and `PTHREAD_MUTEX_ERRORCHECK` not supported:
|
||||
Mutex attribute `PTHREAD_MUTEX_ERRORCHECK` not supported:
|
||||
|
||||
- `pthread_mutex_init()`
|
||||
- `pthread_mutex_destroy()`
|
||||
@@ -33,10 +34,17 @@ Implemented with restrictions:
|
||||
- `pthread_mutexattr_settype()`
|
||||
- `pthread_mutexattr_destroy()`
|
||||
|
||||
Flags `PTHREAD_PROCESS_SHARED` and `PTHREAD_PROCESS_PRIVATE` are not supported:
|
||||
|
||||
- `pthread_spin_init`
|
||||
- `pthread_spin_lock`
|
||||
- `pthread_spin_trylock`
|
||||
- `pthread_spin_unlock`
|
||||
- `pthread_spin_destroy`
|
||||
|
||||
Not implemented:
|
||||
|
||||
- `pthread_once()`
|
||||
- `pthread_detach()`
|
||||
- `sched_yield()`
|
||||
|
||||
- `pthread_cond_init()`
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/errno.h>
|
||||
#include <kolibrios/app.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
#include <kolibrios/tls.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
#define PUSH(sp, val) \
|
||||
do \
|
||||
@@ -19,6 +21,9 @@
|
||||
} \
|
||||
while (0)
|
||||
|
||||
extern void __fini_reent (void);
|
||||
extern __dead2 void __pthread_free_stk_exit (void *stack_lo);
|
||||
|
||||
extern __dead2 void
|
||||
__pthread_thread_entry (pthread_t id, void *(*pthread_fn) (void *), void *arg);
|
||||
|
||||
@@ -26,8 +31,6 @@ int
|
||||
pthread_create (pthread_t *id, const pthread_attr_t *attr,
|
||||
void *(*func) (void *), void *arg)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (attr)
|
||||
return EINVAL;
|
||||
|
||||
@@ -39,12 +42,11 @@ pthread_create (pthread_t *id, const pthread_attr_t *attr,
|
||||
|
||||
__pthread_slots_lock ();
|
||||
|
||||
pthread_t new_id = __pthread_slot_alloc ();
|
||||
pthread_t new_id = __pthread_slot_alloc (stack_lo, 0);
|
||||
struct thread_slot *const slot = __pthread_slot (new_id);
|
||||
if (!slot)
|
||||
{
|
||||
rc = EAGAIN;
|
||||
goto end;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// Prepare a new stack:
|
||||
@@ -64,20 +66,54 @@ pthread_create (pthread_t *id, const pthread_attr_t *attr,
|
||||
(unsigned long)__pthread_thread_entry, (unsigned long)stack_hi);
|
||||
if (tid == -1)
|
||||
{
|
||||
rc = EAGAIN;
|
||||
goto end;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
slot->kos_tid = tid;
|
||||
|
||||
stack_lo = NULL;
|
||||
*id = new_id;
|
||||
|
||||
end:
|
||||
__pthread_slots_unlock ();
|
||||
|
||||
if (stack_lo)
|
||||
_ksys (SF_SYS_MISC, SSF_MEM_FREE, (unsigned long)stack_lo);
|
||||
*id = new_id;
|
||||
return 0;
|
||||
|
||||
return rc;
|
||||
fail:
|
||||
_ksys (SF_SYS_MISC, SSF_MEM_FREE, (unsigned long)stack_lo);
|
||||
__pthread_slot_free (new_id);
|
||||
__pthread_slots_unlock ();
|
||||
|
||||
return EAGAIN;
|
||||
}
|
||||
|
||||
__dead2 void
|
||||
pthread_exit (void *ret)
|
||||
{
|
||||
__pthread_slots_lock ();
|
||||
|
||||
const pthread_t id = pthread_self ();
|
||||
struct thread_slot *const self = __pthread_slot (id);
|
||||
if (!self)
|
||||
{
|
||||
__pthread_slots_unlock ();
|
||||
|
||||
// Trap to debugger
|
||||
__asm__ ("int3");
|
||||
}
|
||||
|
||||
void *stack_lo = self->stack_lo;
|
||||
|
||||
if (self->flags & THREAD_FLAG_DETACHED)
|
||||
{
|
||||
__pthread_slot_free (id);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->ret = ret;
|
||||
self->flags |= THREAD_FLAG_NORMAL_EXIT;
|
||||
}
|
||||
|
||||
__fini_reent ();
|
||||
|
||||
__pthread_slots_unlock ();
|
||||
__pthread_free_stk_exit (stack_lo);
|
||||
__unreachable ();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/errno.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
int
|
||||
pthread_detach (pthread_t id)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
__pthread_slots_lock ();
|
||||
|
||||
struct thread_slot *const slot = __pthread_slot (id);
|
||||
if (!slot)
|
||||
{
|
||||
rc = ESRCH;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (slot->flags & THREAD_FLAG_DETACHED)
|
||||
{
|
||||
rc = EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
slot->flags |= THREAD_FLAG_DETACHED;
|
||||
|
||||
end:
|
||||
__pthread_slots_unlock ();
|
||||
return rc;
|
||||
}
|
||||
@@ -10,4 +10,4 @@ int
|
||||
pthread_equal (pthread_t id1, pthread_t id2)
|
||||
{
|
||||
return id1 == id2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
|
||||
extern void __fini_reent (void);
|
||||
extern __dead2 void __pthread_free_stk_exit (void *stack_lo);
|
||||
|
||||
__dead2 void
|
||||
pthread_exit (void *ret)
|
||||
{
|
||||
__pthread_slots_lock ();
|
||||
|
||||
const pthread_t id = pthread_self ();
|
||||
struct thread_slot *const self = __pthread_slot (id);
|
||||
if (!self)
|
||||
{
|
||||
__pthread_slots_unlock ();
|
||||
|
||||
// Trap to debugger
|
||||
__asm__ ("int3");
|
||||
}
|
||||
|
||||
void *stack_lo = self->stack_lo;
|
||||
|
||||
if (self->detached)
|
||||
{
|
||||
__pthread_slot_free (id);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->ret = ret;
|
||||
self->exit = true;
|
||||
}
|
||||
|
||||
__fini_reent ();
|
||||
|
||||
__pthread_slots_unlock ();
|
||||
__pthread_free_stk_exit (stack_lo);
|
||||
__unreachable ();
|
||||
}
|
||||
@@ -1,21 +1,19 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Basic POSIX thread wrappers for KolibriOS.
|
||||
*
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <kolibrios/dbg.h>
|
||||
#include <kolibrios/tls.h>
|
||||
#include <kolibrios/limits.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#include "pthread_mutex.h"
|
||||
#include "pthread_internal.h"
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
static struct
|
||||
{
|
||||
@@ -27,24 +25,26 @@ static struct
|
||||
void
|
||||
__pthread_slots_lock (void)
|
||||
{
|
||||
__pthread_mutex_lock (&threads.mtx);
|
||||
if (__pthread_mutex_normal_lock (&threads.mtx))
|
||||
__KOS_DBG_TRAP;
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_slots_unlock (void)
|
||||
{
|
||||
__pthread_mutex_unlock (&threads.mtx);
|
||||
if (__pthread_mutex_normal_unlock (&threads.mtx))
|
||||
__KOS_DBG_TRAP;
|
||||
}
|
||||
|
||||
pthread_t
|
||||
__pthread_slot_alloc (void)
|
||||
__pthread_slot_alloc (void *stack_lo, unsigned char flags)
|
||||
{
|
||||
pthread_t id = threads.next_id;
|
||||
|
||||
// First pass: start with the next one
|
||||
for (; id < KOS_THREADS_MAX; id++)
|
||||
{
|
||||
if (!threads.slots[id].lock)
|
||||
if (!(threads.slots[id].flags & THREAD_FLAG_LOCKED))
|
||||
goto found;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ __pthread_slot_alloc (void)
|
||||
id = 0;
|
||||
for (; id < threads.next_id; id++)
|
||||
{
|
||||
if (!threads.slots[id].lock)
|
||||
if (!(threads.slots[id].flags & THREAD_FLAG_LOCKED))
|
||||
goto found;
|
||||
}
|
||||
|
||||
@@ -60,14 +60,16 @@ __pthread_slot_alloc (void)
|
||||
|
||||
found:
|
||||
threads.next_id = id + 1;
|
||||
threads.slots[id].lock = true;
|
||||
threads.slots[id].flags = flags | THREAD_FLAG_LOCKED;
|
||||
threads.slots[id].stack_lo = stack_lo;
|
||||
return id;
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_slot_free (pthread_t id)
|
||||
{
|
||||
__builtin_memset (&threads.slots[id], 0, sizeof (threads.slots[id]));
|
||||
if (id < KOS_THREADS_MAX)
|
||||
__builtin_memset (&threads.slots[id], 0, sizeof (threads.slots[id]));
|
||||
}
|
||||
|
||||
unsigned long
|
||||
@@ -89,30 +91,34 @@ __pthread_slot (pthread_t id)
|
||||
void
|
||||
__pthread_init (void)
|
||||
{
|
||||
if (__pthread_mutex_init (&threads.mtx) < 0)
|
||||
if (__pthread_mutex_init (&threads.mtx, PTHREAD_MUTEX_NORMAL))
|
||||
{
|
||||
// Trap to debugger
|
||||
__asm__ ("int3");
|
||||
__KOS_DBG_TRAP;
|
||||
}
|
||||
|
||||
char thread_info[1024];
|
||||
_ksys (SF_THREAD_INFO, (unsigned long)thread_info, -1);
|
||||
if (_ksys (SF_THREAD_INFO, (unsigned long)thread_info, -1) < 0)
|
||||
{
|
||||
__KOS_DBG_TRAP;
|
||||
}
|
||||
|
||||
threads.slots[0].lock = true;
|
||||
threads.slots[0].kos_tid = KSYS_GET_FROM_BUF (uint32_t, thread_info, 32);
|
||||
threads.slots[0].flags = THREAD_FLAG_LOCKED;
|
||||
threads.slots[0].kos_tid = _KSYS_GET_FROM_BUF (uint32_t, thread_info, 30);
|
||||
threads.next_id = 1;
|
||||
|
||||
__KOS_DBG_PRINTF ("Main TID = %u\n", threads.slots[0].kos_tid);
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_fini (void)
|
||||
void __dead2
|
||||
__pthread_fini_and_exit (void)
|
||||
{
|
||||
__pthread_slots_lock ();
|
||||
|
||||
pthread_t self_id = pthread_self ();
|
||||
unsigned long tid = __pthread_self_tid ();
|
||||
|
||||
for (pthread_t id = 0; id < KOS_THREADS_MAX; id++)
|
||||
{
|
||||
if (self_id == id)
|
||||
if (threads.slots[id].kos_tid == tid)
|
||||
continue;
|
||||
|
||||
if (threads.slots[id].kos_tid)
|
||||
@@ -122,5 +128,11 @@ __pthread_fini (void)
|
||||
}
|
||||
}
|
||||
|
||||
__pthread_slots_unlock ();
|
||||
/*
|
||||
* It is not worth unblocking so that all threads are guaranteed to be
|
||||
* destroyed. Since the futexes will be destroyed when the process ends,
|
||||
* there is no harm in not unlocking.
|
||||
*/
|
||||
_ksys (SF_TERMINATE_PROCESS);
|
||||
__unreachable ();
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_INTERNAL_H_
|
||||
#define _PTHREAD_INTERNAL_H_
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct thread_slot
|
||||
{
|
||||
bool lock;
|
||||
void *stack_lo;
|
||||
unsigned long kos_tid;
|
||||
void *ret;
|
||||
bool exit;
|
||||
bool detached;
|
||||
};
|
||||
|
||||
void __pthread_init (void);
|
||||
void __pthread_fini (void);
|
||||
|
||||
void __pthread_slots_lock (void);
|
||||
void __pthread_slots_unlock (void);
|
||||
|
||||
pthread_t __pthread_slot_alloc (void);
|
||||
void __pthread_slot_free (pthread_t id);
|
||||
|
||||
struct thread_slot *__pthread_slot (pthread_t id);
|
||||
|
||||
#endif /* _PTHREAD_INTERNAL_H_ */
|
||||
@@ -4,10 +4,13 @@
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/errno.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
int
|
||||
pthread_join (pthread_t id, void **ret)
|
||||
@@ -26,7 +29,7 @@ pthread_join (pthread_t id, void **ret)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (slot->detached)
|
||||
if (slot->flags & THREAD_FLAG_DETACHED)
|
||||
{
|
||||
rc = EINVAL;
|
||||
goto end;
|
||||
@@ -50,13 +53,13 @@ pthread_join (pthread_t id, void **ret)
|
||||
|
||||
__pthread_slots_lock ();
|
||||
|
||||
bool exit = slot->exit;
|
||||
bool normal_exit = slot->flags & THREAD_FLAG_NORMAL_EXIT;
|
||||
void *save_ret = slot->ret;
|
||||
|
||||
__pthread_slot_free (id);
|
||||
|
||||
// If the thread terminated unexpectedly
|
||||
if (!exit)
|
||||
if (!normal_exit)
|
||||
{
|
||||
rc = ESRCH;
|
||||
goto end;
|
||||
|
||||
@@ -9,82 +9,60 @@
|
||||
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#include "pthread_mutex.h"
|
||||
|
||||
static void
|
||||
spin_lock (atomic_flag *lock)
|
||||
{
|
||||
while (atomic_flag_test_and_set_explicit (lock, memory_order_acquire))
|
||||
{
|
||||
__builtin_ia32_pause ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
spin_unlock (atomic_flag *lock)
|
||||
{
|
||||
atomic_flag_clear_explicit (lock, memory_order_release);
|
||||
}
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
int
|
||||
pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
|
||||
{
|
||||
if (mutex->futex.hdlr)
|
||||
return EBUSY;
|
||||
|
||||
*mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
if (__pthread_mutex_init (mutex) < 0)
|
||||
return EAGAIN;
|
||||
|
||||
return 0;
|
||||
int type = attr ? attr->kind : PTHREAD_MUTEX_NORMAL;
|
||||
return __pthread_mutex_init (mutex, type);
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutex_lock (pthread_mutex_t *mutex)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (mutex->recursive)
|
||||
return EINVAL;
|
||||
|
||||
spin_lock (&mutex->futex.lock);
|
||||
if (mutex->futex.hdlr)
|
||||
rc = __pthread_mutex_init (mutex);
|
||||
spin_unlock (&mutex->futex.lock);
|
||||
|
||||
if (rc < 0)
|
||||
return EINVAL;
|
||||
|
||||
__pthread_mutex_lock (mutex);
|
||||
return 0;
|
||||
switch (mutex->kind)
|
||||
{
|
||||
case PTHREAD_MUTEX_NORMAL:
|
||||
return __pthread_mutex_normal_lock (mutex);
|
||||
case PTHREAD_MUTEX_RECURSIVE:
|
||||
return __pthread_mutex_recursive_lock (mutex);
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutex_trylock (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (mutex->recursive)
|
||||
return EINVAL;
|
||||
|
||||
if (__pthread_mutex_try_lock (mutex))
|
||||
return 0;
|
||||
|
||||
return EBUSY;
|
||||
switch (mutex->kind)
|
||||
{
|
||||
case PTHREAD_MUTEX_NORMAL:
|
||||
return __pthread_mutex_normal_trylock (mutex);
|
||||
case PTHREAD_MUTEX_RECURSIVE:
|
||||
return __pthread_mutex_recursive_trylock (mutex);
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutex_unlock (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (mutex->recursive)
|
||||
return EINVAL;
|
||||
|
||||
__pthread_mutex_unlock (mutex);
|
||||
return 0;
|
||||
switch (mutex->kind)
|
||||
{
|
||||
case PTHREAD_MUTEX_NORMAL:
|
||||
return __pthread_mutex_normal_unlock (mutex);
|
||||
case PTHREAD_MUTEX_RECURSIVE:
|
||||
return __pthread_mutex_recursive_unlock (mutex);
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutex_destroy (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (__pthread_mutex_destroy (mutex) < 0)
|
||||
return EINVAL;
|
||||
}
|
||||
return __pthread_mutex_destroy (mutex);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_MUTEX_IMPL_H_
|
||||
#define _PTHREAD_MUTEX_IMPL_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/_pthreadtypes.h>
|
||||
|
||||
int __pthread_mutex_init (pthread_mutex_t *mutex);
|
||||
void __pthread_mutex_lock (pthread_mutex_t *mutex);
|
||||
bool __pthread_mutex_try_lock (pthread_mutex_t *mutex);
|
||||
void __pthread_mutex_unlock (pthread_mutex_t *mutex);
|
||||
int __pthread_mutex_destroy (pthread_mutex_t *mutex);
|
||||
|
||||
#endif /* _PTHREAD_MUTEX_IMPL_H_ */
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Basic POSIX thread wrappers for KolibriOS.
|
||||
*
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <stdatomic.h>
|
||||
#include <sys/time.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#include "pthread_mutex.h"
|
||||
|
||||
int
|
||||
__pthread_mutex_init (pthread_mutex_t *mutex)
|
||||
{
|
||||
mutex->lock = 0;
|
||||
mutex->futex.hdlr = _ksys (SF_FUTEX, SSF_CREATE, mutex->lock);
|
||||
if (!mutex->futex.hdlr)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
__pthread_mutex_destroy (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (_ksys (SF_FUTEX, SSF_DESTROY, mutex->futex.hdlr) < 0)
|
||||
return -1;
|
||||
|
||||
mutex->futex.hdlr = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_mutex_lock (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (atomic_fetch_add (&mutex->lock, 1) == 0)
|
||||
return;
|
||||
|
||||
while (atomic_exchange_explicit (&mutex->lock, 2, memory_order_acquire) != 0)
|
||||
{
|
||||
_ksys (SF_FUTEX, SSF_WAIT, mutex->futex.hdlr, 2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
__pthread_mutex_try_lock (pthread_mutex_t *mutex)
|
||||
{
|
||||
int zero = 0;
|
||||
|
||||
return atomic_compare_exchange_strong_explicit (
|
||||
&mutex->lock, &zero, 1, memory_order_acquire, memory_order_relaxed);
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_mutex_unlock (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (atomic_exchange_explicit (&mutex->lock, 0, memory_order_release) != 1)
|
||||
{
|
||||
_ksys (SF_FUTEX, SSF_DESTROY, mutex->futex.hdlr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/errno.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
int
|
||||
__pthread_futex_init_once (pthread_mutex_t *mutex)
|
||||
{
|
||||
pthread_spin_lock (&mutex->futex.spinlock);
|
||||
|
||||
if (!mutex->futex.hdlr)
|
||||
mutex->futex.hdlr
|
||||
= _ksys (SF_FUTEX, SSF_CREATE, (unsigned long)&mutex->lock);
|
||||
|
||||
pthread_spin_unlock (&mutex->futex.spinlock);
|
||||
|
||||
return mutex->futex.hdlr ? 0 : -1;
|
||||
}
|
||||
|
||||
int
|
||||
__pthread_mutex_init (pthread_mutex_t *mutex, int type)
|
||||
{
|
||||
if (mutex->futex.hdlr)
|
||||
return EBUSY;
|
||||
|
||||
*mutex = __PTHREAD_MUTEX_INITIALIZER_KIND (type);
|
||||
|
||||
mutex->futex.hdlr
|
||||
= _ksys (SF_FUTEX, SSF_CREATE, (unsigned long)&mutex->lock);
|
||||
return mutex->futex.hdlr ? 0 : EAGAIN;
|
||||
}
|
||||
|
||||
int
|
||||
__pthread_mutex_destroy (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (!mutex->futex.hdlr)
|
||||
return EINVAL;
|
||||
|
||||
if (_ksys (SF_FUTEX, SSF_DESTROY, mutex->futex.hdlr) < 0)
|
||||
return EINVAL;
|
||||
|
||||
mutex->futex.hdlr = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <stdatomic.h>
|
||||
#include <sys/errno.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
int
|
||||
__pthread_mutex_normal_lock (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (atomic_fetch_add (&mutex->lock, 1) == 0)
|
||||
{
|
||||
return __pthread_futex_init_once (mutex) < 0 ? EAGAIN : 0;
|
||||
}
|
||||
|
||||
while (atomic_exchange_explicit (&mutex->lock, 2, memory_order_acquire) != 0)
|
||||
{
|
||||
_ksys (SF_FUTEX, SSF_WAIT, mutex->futex.hdlr, 2, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
__pthread_mutex_normal_trylock (pthread_mutex_t *mutex)
|
||||
{
|
||||
int zero = 0;
|
||||
|
||||
return atomic_compare_exchange_strong_explicit (&mutex->lock, &zero, 1,
|
||||
memory_order_acquire,
|
||||
memory_order_relaxed)
|
||||
? 0
|
||||
: EBUSY;
|
||||
}
|
||||
|
||||
int
|
||||
__pthread_mutex_normal_unlock (pthread_mutex_t *mutex)
|
||||
{
|
||||
if (atomic_exchange_explicit (&mutex->lock, 0, memory_order_release) != 1)
|
||||
{
|
||||
_ksys (SF_FUTEX, SSF_WAKE, mutex->futex.hdlr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdatomic.h>
|
||||
#include <sys/errno.h>
|
||||
#include <kolibrios/syscall.h>
|
||||
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
int
|
||||
__pthread_mutex_recursive_lock (pthread_mutex_t *mutex)
|
||||
{
|
||||
unsigned long self_tid = __pthread_self_tid ();
|
||||
|
||||
if (atomic_fetch_add (&mutex->lock, 1) == 0)
|
||||
{
|
||||
if (__pthread_futex_init_once (mutex))
|
||||
return EAGAIN;
|
||||
|
||||
mutex->depth = 1;
|
||||
mutex->owner = self_tid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mutex->owner == self_tid)
|
||||
{
|
||||
atomic_fetch_sub (&mutex->lock, 1);
|
||||
|
||||
if (mutex->depth == INT_MAX)
|
||||
return EAGAIN;
|
||||
|
||||
++(mutex->depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (atomic_exchange_explicit (&mutex->lock, 2, memory_order_acquire) != 0)
|
||||
{
|
||||
_ksys (SF_FUTEX, SSF_WAIT, mutex->futex.hdlr, 2, 0);
|
||||
|
||||
mutex->depth = 1;
|
||||
mutex->owner = self_tid;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
__pthread_mutex_recursive_trylock (pthread_mutex_t *mutex)
|
||||
{
|
||||
int zero = 0;
|
||||
unsigned long self_tid = __pthread_self_tid ();
|
||||
|
||||
if (atomic_compare_exchange_strong_explicit (
|
||||
&mutex->lock, &zero, 1, memory_order_acquire, memory_order_relaxed))
|
||||
{
|
||||
mutex->depth = 1;
|
||||
mutex->owner = self_tid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mutex->owner == self_tid)
|
||||
{
|
||||
if (mutex->depth == INT_MAX)
|
||||
return EAGAIN;
|
||||
|
||||
++(mutex->depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
int
|
||||
__pthread_mutex_recursive_unlock (pthread_mutex_t *mutex)
|
||||
{
|
||||
unsigned long self_tid = __pthread_self_tid ();
|
||||
|
||||
if (mutex->owner != self_tid)
|
||||
return EPERM;
|
||||
|
||||
--(mutex->depth);
|
||||
|
||||
if (mutex->depth > 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mutex->owner = 0;
|
||||
|
||||
if (atomic_exchange_explicit (&mutex->lock, 0, memory_order_release) != 1)
|
||||
{
|
||||
_ksys (SF_FUTEX, SSF_WAKE, mutex->futex.hdlr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/errno.h>
|
||||
@@ -5,29 +10,36 @@
|
||||
int
|
||||
pthread_mutexattr_init (pthread_mutexattr_t *attr)
|
||||
{
|
||||
attr->type = PTHREAD_MUTEX_DEFAULT;
|
||||
attr->kind = PTHREAD_MUTEX_DEFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutexattr_destroy (pthread_mutexattr_t *attr)
|
||||
{
|
||||
attr->type = PTHREAD_MUTEX_DEFAULT;
|
||||
attr->kind = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type)
|
||||
pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind)
|
||||
{
|
||||
if (type != PTHREAD_MUTEX_NORMAL && type != PTHREAD_MUTEX_DEFAULT)
|
||||
return EINVAL;
|
||||
|
||||
return 0;
|
||||
switch (kind)
|
||||
{
|
||||
case PTHREAD_MUTEX_NORMAL:
|
||||
case PTHREAD_MUTEX_RECURSIVE:
|
||||
{
|
||||
attr->kind = kind;
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *type)
|
||||
pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *kind)
|
||||
{
|
||||
*type = attr->type;
|
||||
*kind = attr->kind;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
int
|
||||
pthread_spin_init (pthread_spinlock_t *spin_lock, int phared)
|
||||
{
|
||||
spin_lock->lock = (atomic_flag)ATOMIC_FLAG_INIT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pthread_spin_destroy (pthread_spinlock_t *spin_lock)
|
||||
{
|
||||
spin_lock->lock = (atomic_flag)ATOMIC_FLAG_INIT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pthread_spin_lock (pthread_spinlock_t *spin_lock)
|
||||
{
|
||||
while (atomic_flag_test_and_set_explicit (&spin_lock->lock,
|
||||
memory_order_acquire))
|
||||
__builtin_ia32_pause ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pthread_spin_trylock (pthread_spinlock_t *spin_lock)
|
||||
{
|
||||
|
||||
if (atomic_flag_test_and_set_explicit (&spin_lock->lock,
|
||||
memory_order_acquire))
|
||||
return EBUSY;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pthread_spin_unlock (pthread_spinlock_t *spin_lock)
|
||||
{
|
||||
atomic_flag_clear_explicit (&spin_lock->lock, memory_order_release);
|
||||
return 0;
|
||||
}
|
||||
58
libraries/newlib/newlib/libc/sys/kolibrios/sys/_pthread.h
Normal file
58
libraries/newlib/newlib/libc/sys/kolibrios/sys/_pthread.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
* POSIX threads internal functions.
|
||||
* Copyright (C) 2026 KolibriOS team
|
||||
* Author: Maxim Logaev <maxlogaev@proton.me>
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_INTERNAL_H_
|
||||
#define _PTHREAD_INTERNAL_H_
|
||||
|
||||
#ifdef _PTHREAD_LIBC_IMPL
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_pthreadtypes.h>
|
||||
|
||||
#define THREAD_FLAG_LOCKED (1 << 0)
|
||||
#define THREAD_FLAG_DETACHED (1 << 1)
|
||||
#define THREAD_FLAG_NORMAL_EXIT (1 << 2)
|
||||
|
||||
struct thread_slot
|
||||
{
|
||||
unsigned char flags;
|
||||
void *stack_lo;
|
||||
unsigned long kos_tid;
|
||||
void *ret;
|
||||
};
|
||||
|
||||
void __pthread_init (void);
|
||||
void __dead2 __pthread_fini_and_exit (void);
|
||||
|
||||
void __pthread_slots_lock (void);
|
||||
void __pthread_slots_unlock (void);
|
||||
|
||||
pthread_t __pthread_slot_alloc (void *stack_lo, unsigned char flags);
|
||||
void __pthread_slot_free (pthread_t id);
|
||||
struct thread_slot *__pthread_slot (pthread_t id);
|
||||
unsigned long __pthread_self_tid (void);
|
||||
|
||||
int __pthread_spin_normal_lock (pthread_spinlock_t *spinlock);
|
||||
int __pthread_spin_normal_trylock (pthread_spinlock_t *spinlock);
|
||||
int __pthread_spin_normal_unlock (pthread_spinlock_t *spinlock);
|
||||
|
||||
int __pthread_futex_init_once (pthread_mutex_t *mutex);
|
||||
|
||||
int __pthread_mutex_init (pthread_mutex_t *mutex, int kind);
|
||||
int __pthread_mutex_destroy (pthread_mutex_t *mutex);
|
||||
|
||||
int __pthread_mutex_normal_lock (pthread_mutex_t *mutex);
|
||||
int __pthread_mutex_normal_trylock (pthread_mutex_t *mutex);
|
||||
int __pthread_mutex_normal_unlock (pthread_mutex_t *mutex);
|
||||
|
||||
int __pthread_mutex_recursive_lock (pthread_mutex_t *mutex);
|
||||
int __pthread_mutex_recursive_trylock (pthread_mutex_t *mutex);
|
||||
int __pthread_mutex_recursive_unlock (pthread_mutex_t *mutex);
|
||||
|
||||
#endif /*_PTHREAD_LIBC_IMPL */
|
||||
|
||||
#endif /* _PTHREAD_INTERNAL_H_ */
|
||||
@@ -1,66 +1,68 @@
|
||||
#ifndef __SYS_LOCK_H__
|
||||
#define __SYS_LOCK_H__
|
||||
|
||||
#undef type
|
||||
#include <kolibrios/dbg.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define _PTHREAD_LIBC_IMPL
|
||||
#include <sys/_pthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define __PTHREAD_LOCK_TEMPL(pthread_fn, ...) \
|
||||
static inline void __lock_##pthread_fn (pthread_mutex_t *lock) \
|
||||
#define __PTHREAD_LOCK_TEMPL(postfix) \
|
||||
static inline void __lock_pthread_mutex_##postfix (pthread_mutex_t *lock) \
|
||||
{ \
|
||||
if (pthread_fn (lock, ##__VA_ARGS__)) \
|
||||
if (__pthread_mutex_##postfix (lock)) \
|
||||
{ \
|
||||
/* Trap to debugger */ \
|
||||
__asm__ ("int3"); \
|
||||
__KOS_DBG_TRAP; \
|
||||
} \
|
||||
}
|
||||
|
||||
__PTHREAD_LOCK_TEMPL (pthread_mutex_init, NULL);
|
||||
__PTHREAD_LOCK_TEMPL (pthread_mutex_destroy)
|
||||
__PTHREAD_LOCK_TEMPL (pthread_mutex_lock)
|
||||
__PTHREAD_LOCK_TEMPL (pthread_mutex_unlock)
|
||||
__PTHREAD_LOCK_TEMPL (destroy)
|
||||
__PTHREAD_LOCK_TEMPL (normal_lock)
|
||||
__PTHREAD_LOCK_TEMPL (normal_unlock)
|
||||
__PTHREAD_LOCK_TEMPL (recursive_lock)
|
||||
__PTHREAD_LOCK_TEMPL (recursive_unlock)
|
||||
|
||||
typedef pthread_mutex_t _LOCK_T;
|
||||
typedef pthread_mutex_t _LOCK_RECURSIVE_T;
|
||||
static inline void
|
||||
__lock_pthread_mutex_init (pthread_mutex_t *lock, int kind)
|
||||
{
|
||||
if (__pthread_mutex_init (lock, kind))
|
||||
{
|
||||
__KOS_DBG_TRAP;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------- Normal ---------------------------------- */
|
||||
|
||||
#define __LOCK_INIT(CLASS, LOCK) CLASS _LOCK_T LOCK = PTHREAD_MUTEX_INITIALIZER
|
||||
typedef pthread_mutex_t _LOCK_T;
|
||||
|
||||
#define __lock_init(LOCK) __lock_pthread_mutex_init (&(LOCK))
|
||||
#define __LOCK_INIT(CLASS, LOCK) CLASS _LOCK_T LOCK = _PTHREAD_NORMAL_MUTEX_INITIALIZER_NP
|
||||
|
||||
#define __lock_init(LOCK) \
|
||||
__lock_pthread_mutex_init (&(LOCK, PTHREAD_MUTEX_NORMAL))
|
||||
#define __lock_close(LOCK) __lock_pthread_mutex_destroy (&(LOCK))
|
||||
|
||||
#define __lock_acquire(LOCK) __lock_pthread_mutex_lock (&(LOCK))
|
||||
#define __lock_release(LOCK) __lock_pthread_mutex_unlock (&(LOCK))
|
||||
|
||||
#define __LOCK_INIT_RECURSIVE(CLASS, LOCK) \
|
||||
CLASS _LOCK_T LOCK = _PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
#define __lock_acquire(LOCK) __lock_pthread_mutex_normal_lock (&(LOCK))
|
||||
#define __lock_release(LOCK) __lock_pthread_mutex_normal_unlock (&(LOCK))
|
||||
|
||||
/* ------------------------------- Recursive ------------------------------- */
|
||||
|
||||
static inline void
|
||||
__lock_pthread_recursive_mutex_init (pthread_mutex_t *mutex)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init (&attr);
|
||||
if (pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE))
|
||||
__KOS_DBG_TRAP;
|
||||
typedef pthread_mutex_t _LOCK_RECURSIVE_T;
|
||||
|
||||
if (pthread_mutex_init (mutex, &attr))
|
||||
__KOS_DBG_TRAP;
|
||||
}
|
||||
#define __LOCK_INIT_RECURSIVE(CLASS, LOCK) \
|
||||
CLASS _LOCK_T LOCK = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
|
||||
#define __lock_init_recursive(LOCK) \
|
||||
__lock_pthread_recursive_mutex_init (&(LOCK))
|
||||
__lock_pthread_mutex_init (&(LOCK), PTHREAD_MUTEX_RECURSIVE)
|
||||
#define __lock_close_recursive(LOCK) __lock_pthread_mutex_destroy (&(LOCK))
|
||||
|
||||
#define __lock_acquire_recursive(LOCK) __lock_pthread_mutex_lock (&(LOCK))
|
||||
#define __lock_release_recursive(LOCK) __lock_pthread_mutex_unlock (&(LOCK))
|
||||
#define __lock_acquire_recursive(LOCK) \
|
||||
__lock_pthread_mutex_recursive_lock (&(LOCK))
|
||||
#define __lock_release_recursive(LOCK) \
|
||||
__lock_pthread_mutex_recursive_unlock (&(LOCK))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user