From f0b714d5adaa8a660aeaad55d73d6bdbc9805804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Fri, 10 Nov 2023 14:13:13 +0100 Subject: [PATCH] * Add pthread_mutex_timedlock, sem_timedwait may be needed in future --- rtl/freebsd/pthread.inc | 4 +++- rtl/linux/pthread.inc | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rtl/freebsd/pthread.inc b/rtl/freebsd/pthread.inc index 25a27dc3ff..91191e4c99 100644 --- a/rtl/freebsd/pthread.inc +++ b/rtl/freebsd/pthread.inc @@ -90,7 +90,8 @@ function pthread_self:pthread_t; cdecl;external; function pthread_mutex_init (p:ppthread_mutex_t;o:ppthread_mutex_attr_t):cint; cdecl;external; function pthread_mutex_destroy (p:ppthread_mutex_attr_t):cint; cdecl;external; function pthread_mutex_lock (p:ppthread_mutex_attr_t):cint; cdecl;external; -function pthread_mutex_trylock (p:ppthread_mutex_attr_t):cint; cdecl;external; +function pthread_mutex_timedlock(__mutex:ppthread_mutex_t; __abs_timeout:ptimespec):longint;cdecl; external; +function pthread_mutex_trylock(p:ppthread_mutex_attr_t):cint; cdecl;external; function pthread_mutex_unlock (p:ppthread_mutex_attr_t):cint; cdecl;external; function pthread_cancel(_para1:pthread_t):cint;cdecl;external; function pthread_detach(_para1:pthread_t):cint;cdecl;external; @@ -109,6 +110,7 @@ function sem_close(__sem:Psem_t):cint;cdecl;external ; function sem_unlink(__name:PAnsiChar):cint;cdecl;external ; function sem_wait(__sem:Psem_t):cint;cdecl;external ; function sem_trywait(__sem:Psem_t):cint;cdecl;external ; +function sem_timedwait (__sem:Psem_t; __abs_timeout:ptimespec):longint;cdecl;external; function sem_post(__sem:Psem_t):cint;cdecl;external ; function sem_getvalue(__sem:Psem_t; __sval:Pcint):cint;cdecl;external; function pthread_mutexattr_init(_para1:Ppthread_mutexattr_t):cint;cdecl;external; diff --git a/rtl/linux/pthread.inc b/rtl/linux/pthread.inc index 11d54b3d22..7ad9a60873 100644 --- a/rtl/linux/pthread.inc +++ b/rtl/linux/pthread.inc @@ -139,6 +139,7 @@ Type function pthread_mutex_init(__mutex:ppthread_mutex_t; __mutex_attr:ppthread_mutexattr_t):longint;cdecl;external; function pthread_mutex_destroy(__mutex:ppthread_mutex_t):longint;cdecl;external; function pthread_mutex_trylock(__mutex:ppthread_mutex_t):longint;cdecl;external; + function pthread_mutex_timedlock(__mutex:ppthread_mutex_t; __abs_timeout:ptimespec):longint;cdecl;external; function pthread_mutex_lock(__mutex:ppthread_mutex_t):longint;cdecl;external; function pthread_mutex_unlock(__mutex:ppthread_mutex_t):longint;cdecl;external; function pthread_mutexattr_init(__attr:ppthread_mutexattr_t):longint;cdecl;external; @@ -221,6 +222,7 @@ Var pthread_mutex_init : Function(__mutex:ppthread_mutex_t; __mutex_attr:ppthread_mutexattr_t):longint;cdecl; pthread_mutex_destroy : Function(__mutex:ppthread_mutex_t):longint;cdecl; pthread_mutex_trylock : Function(__mutex:ppthread_mutex_t):longint;cdecl; + pthread_mutex_timedlock : Function(__mutex:ppthread_mutex_t; __abs_timeout:ptimespec):longint;cdecl; pthread_mutex_lock : Function(__mutex:ppthread_mutex_t):longint;cdecl; pthread_mutex_unlock : Function(__mutex:ppthread_mutex_t):longint;cdecl; pthread_mutexattr_init : Function(__attr:ppthread_mutexattr_t):longint;cdecl; @@ -316,6 +318,7 @@ begin Pointer(pthread_mutex_init) := dlsym(PthreadDLL,'pthread_mutex_init'); Pointer(pthread_mutex_destroy) := dlsym(PthreadDLL,'pthread_mutex_destroy'); Pointer(pthread_mutex_trylock) := dlsym(PthreadDLL,'pthread_mutex_trylock'); + Pointer(pthread_mutex_timedlock) := dlsym(PthreadDLL,'pthread_mutex_timedlock'); Pointer(pthread_mutex_lock) := dlsym(PthreadDLL,'pthread_mutex_lock'); Pointer(pthread_mutex_unlock) := dlsym(PthreadDLL,'pthread_mutex_unlock'); Pointer(pthread_mutexattr_init) := dlsym(PthreadDLL,'pthread_mutexattr_init');