]> git.sesse.net Git - vlc/blobdiff - test/native/threads.c
Added initial support for TLS (Thread Local Storage) variables
[vlc] / test / native / threads.c
diff --git a/test/native/threads.c b/test/native/threads.c
new file mode 100644 (file)
index 0000000..d49be79
--- /dev/null
@@ -0,0 +1,19 @@
+#include "../pyunit.h"
+#include <vlc/vlc.h>
+
+PyObject *threadvar_test( PyObject *self, PyObject *args )
+{
+    void *p_foo = malloc(1);
+    vlc_threadvar_t key, key2;
+
+    vlc_threadvar_create( NULL, &key );
+    vlc_threadvar_set( &key, p_foo );
+    ASSERT( vlc_threadvar_get( &key ) == p_foo, "key does not match" );
+
+    vlc_threadvar_create( NULL, &key2 );
+    vlc_threadvar_set( &key2, NULL );
+    ASSERT( vlc_threadvar_get( &key2 ) == NULL, "key2 does not match" );
+    
+    Py_INCREF( Py_None );
+    return Py_None;
+}