diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-11-05 18:52:20 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-11-23 06:55:12 -0500 |
commit | 3baee7ccba467a3ddc1cb6bfb1a4cabd40cd7424 (patch) | |
tree | cd997ea09534ba203a372e75ccfcdde402a439da /util.c | |
parent | 04106f2e5c6e8162bd22fd9c7505096116e483cd (diff) | |
download | perl-3baee7ccba467a3ddc1cb6bfb1a4cabd40cd7424.tar.gz |
clang thread safety annotations
http://clang.llvm.org/docs/ThreadSafetyAnalysis.html
Static (compile-time) annotations for declaring the multithreaded
behavior of functions, variables, and capabilities (like mutexes).
Available since about clang 3.5.
./Configure -des -Dusedevel -Dusethreads -Dcc=clang -Accflags='-Wthread-safety'
clang -Wthread-safety then checks the validity of the annotations.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -6577,6 +6577,28 @@ Perl_dump_c_backtrace(pTHX_ PerlIO* fp, int depth, int skip) #endif /* #ifdef USE_C_BACKTRACE */ +#ifdef PERL_TSA_ACTIVE + +/* pthread_mutex_t and perl_mutex are typedef equivalent + * so casting the pointers is fine. */ + +int perl_tsa_mutex_lock(perl_mutex* mutex) +{ + return pthread_mutex_lock((pthread_mutex_t *) mutex); +} + +int perl_tsa_mutex_unlock(perl_mutex* mutex) +{ + return pthread_mutex_unlock((pthread_mutex_t *) mutex); +} + +int perl_tsa_mutex_destroy(perl_mutex* mutex) +{ + return pthread_mutex_destroy((pthread_mutex_t *) mutex); +} + +#endif + /* * ex: set ts=8 sts=4 sw=4 et: */ |