summaryrefslogtreecommitdiff
path: root/common/JackGlobals.cpp
diff options
context:
space:
mode:
authorsletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2008-10-09 08:30:05 +0000
committersletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224>2008-10-09 08:30:05 +0000
commit28ef03b8793e93282abcdcf82c059836d21bc5a4 (patch)
tree5cc90727ce2176272a4f9eb0ead15b7e8fcbe1c0 /common/JackGlobals.cpp
parent23fab4f1bbb71e5df3aac24680f7341f3fc00ff0 (diff)
downloadjack2-28ef03b8793e93282abcdcf82c059836d21bc5a4.tar.gz
Use a mutex to make jack_client_open/jack_client_close thread safe, remove use of jack_init/jack_uninit.
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2968 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'common/JackGlobals.cpp')
-rw-r--r--common/JackGlobals.cpp83
1 files changed, 4 insertions, 79 deletions
diff --git a/common/JackGlobals.cpp b/common/JackGlobals.cpp
index ca870d07..2888da64 100644
--- a/common/JackGlobals.cpp
+++ b/common/JackGlobals.cpp
@@ -19,85 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackGlobals.h"
-static bool gKeyRealtimeInitialized = false;
-static bool g_key_log_function_initialized = false;
-
jack_tls_key gRealTime;
-jack_tls_key g_key_log_function;
-
-// Initialisation at library load time
-#ifdef WIN32
-
-static void jack_init()
-{
- if (!gKeyRealtimeInitialized) {
- gKeyRealtimeInitialized = jack_tls_allocate_key(&gRealTime);
- }
-
- if (!g_key_log_function_initialized)
- g_key_log_function_initialized = jack_tls_allocate_key(&g_key_log_function);
-}
-
-static void jack_uninit()
-{
- if (gKeyRealtimeInitialized) {
- jack_tls_free_key(gRealTime);
- gKeyRealtimeInitialized = false;
- }
-
- if (g_key_log_function_initialized) {
- jack_tls_free_key(g_key_log_function);
- g_key_log_function_initialized = false;
- }
-}
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
+static bool gKeyRealtimeInitialized = jack_tls_allocate_key(&gRealTime);
-BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- jack_init();
- break;
- case DLL_PROCESS_DETACH:
- jack_uninit();
- break;
- }
- return TRUE;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#else
-
-__attribute__ ((constructor))
-static void jack_init()
-{
- if (!gKeyRealtimeInitialized) {
- gKeyRealtimeInitialized = jack_tls_allocate_key(&gRealTime);
- }
-
- if (!g_key_log_function_initialized)
- g_key_log_function_initialized = jack_tls_allocate_key(&g_key_log_function);
-}
-
-__attribute__ ((destructor))
-static void jack_uninit()
-{
- if (gKeyRealtimeInitialized) {
- jack_tls_free_key(gRealTime);
- gKeyRealtimeInitialized = false;
- }
-
- if (g_key_log_function_initialized) {
- jack_tls_free_key(g_key_log_function);
- g_key_log_function_initialized = false;
- }
-}
+jack_tls_key g_key_log_function;
+static bool g_key_log_function_initialized = jack_tls_allocate_key(&g_key_log_function);
-#endif
+JackMutex* gOpenMutex = new JackMutex();