summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-18 22:34:48 +0100
committerwm4 <wm4@nowhere>2020-03-18 22:42:13 +0100
commitcb82cbbbae99d5b8beebae76320a9097a2bc34f7 (patch)
tree144715054c3ac0ee203dcc23004e583923334961 /wscript
parent373dad9962e4d7b23b95fc95bbbe811c8adafc92 (diff)
downloadmpv-cb82cbbbae99d5b8beebae76320a9097a2bc34f7.tar.bz2
mpv-cb82cbbbae99d5b8beebae76320a9097a2bc34f7.tar.xz
osdep: add a pthread debugging wrapper
Because pthread failures are virtually undebuggable (which sure is pretty strange, given all these heavy instrumentation tools these days). Of course it affects only files which include osdep/threads.h. I'm departing from the usual way to add symbols with config.h and using "#if", and defining it on the compiler command line + "#ifdef" because I don't want to include config.h from a header (which would be necessary in this case) to keep things slightly cleaner. Maybe this is misguided, but still. This would have been easier if mpv defined its own wrappers for all thread functions. But we don't (which to be honest is probably better than e.g. going crazy like VLC and essentially reimplementing everything). This seems to be a good compromise. Since it's off by default and basically a developer tool, the minor undefined behavior (redefining reserved symbols) isn't much of an issue.
Diffstat (limited to 'wscript')
-rw-r--r--wscript9
1 files changed, 9 insertions, 0 deletions
diff --git a/wscript b/wscript
index a2451e8009..1dda323f67 100644
--- a/wscript
+++ b/wscript
@@ -206,6 +206,15 @@ main_dependencies = [
'req': True,
'fmsg': 'Unable to find pthreads support.'
}, {
+ # NB: this works only if a source file includes osdep/threads.h
+ # also, technically, triggers undefined behavior (reserved names)
+ 'name': '--pthread-debug',
+ 'desc': 'pthread runtime debugging wrappers',
+ 'default': 'disable',
+ 'func': check_cc(cflags='-DMP_PTHREAD_DEBUG'),
+ # The win32 wrapper defines pthreads symbols as macros only.
+ 'deps_neg': 'win32-internal-pthreads',
+ }, {
'name': '--stdatomic',
'desc': 'C11 stdatomic.h',
'func': check_libs(['atomic'],