git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2457 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
| @@ -41,14 +41,33 @@ struct AtomicCounter | |||||
| UInt32 fLongVal; | UInt32 fLongVal; | ||||
| }info; | }info; | ||||
| AtomicCounter& operator=(volatile AtomicCounter& obj) | |||||
| AtomicCounter() | |||||
| { | |||||
| info.fLongVal = 0; | |||||
| } | |||||
| AtomicCounter(volatile const AtomicCounter& obj) | |||||
| { | |||||
| info.fLongVal = obj.info.fLongVal; | |||||
| } | |||||
| AtomicCounter(volatile AtomicCounter& obj) | |||||
| { | |||||
| info.fLongVal = obj.info.fLongVal; | |||||
| } | |||||
| AtomicCounter& operator=(AtomicCounter& obj) | |||||
| { | { | ||||
| info.fLongVal = obj.info.fLongVal; | info.fLongVal = obj.info.fLongVal; | ||||
| return *this; | return *this; | ||||
| } | } | ||||
| }; | |||||
| AtomicCounter& operator=(volatile AtomicCounter& obj) | |||||
| { | |||||
| info.fLongVal = obj.info.fLongVal; | |||||
| return *this; | |||||
| } | |||||
| }; | |||||
| #define Counter(e) (e).info.fLongVal | #define Counter(e) (e).info.fLongVal | ||||
| #define CurIndex(e) (e).info.scounter.fShortVal1 | #define CurIndex(e) (e).info.scounter.fShortVal1 | ||||
| @@ -2,18 +2,18 @@ | |||||
| Copyright (C) 2004-2005 Grame | Copyright (C) 2004-2005 Grame | ||||
| This program is free software; you can redistribute it and/or modify | This program is free software; you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | |||||
| the Free Software Foundation; either version 2 of the License, or | |||||
| (at your option) any later version. | |||||
| This program is distributed in the hope that it will be useful, | |||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| GNU General Public License for more details. | |||||
| You should have received a copy of the GNU General Public License | |||||
| along with this program; if not, write to the Free Software | |||||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
| it under the terms of the GNU General Public License as published by | |||||
| the Free Software Foundation; either version 2 of the License, or | |||||
| (at your option) any later version. | |||||
| This program is distributed in the hope that it will be useful, | |||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| GNU General Public License for more details. | |||||
| You should have received a copy of the GNU General Public License | |||||
| along with this program; if not, write to the Free Software | |||||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||||
| */ | */ | ||||
| @@ -29,7 +29,15 @@ static bool g_key_log_function_initialized = false; | |||||
| jack_tls_key gRealTime; | jack_tls_key gRealTime; | ||||
| jack_tls_key g_key_log_function; | jack_tls_key g_key_log_function; | ||||
| __attribute__ ((constructor)) | |||||
| // Initialisation at library load time | |||||
| #ifdef WIN32 | |||||
| #ifdef __cplusplus | |||||
| extern "C" | |||||
| { | |||||
| #endif | |||||
| static void jack_init() | static void jack_init() | ||||
| { | { | ||||
| if (!gKeyRealtimeInitialized) { | if (!gKeyRealtimeInitialized) { | ||||
| @@ -40,7 +48,6 @@ static void jack_init() | |||||
| g_key_log_function_initialized = jack_tls_allocate_key(&g_key_log_function); | g_key_log_function_initialized = jack_tls_allocate_key(&g_key_log_function); | ||||
| } | } | ||||
| __attribute__ ((destructor)) | |||||
| static void jack_uninit() | static void jack_uninit() | ||||
| { | { | ||||
| if (gKeyRealtimeInitialized) { | if (gKeyRealtimeInitialized) { | ||||
| @@ -54,15 +61,6 @@ static void jack_uninit() | |||||
| } | } | ||||
| } | } | ||||
| // Initialisation at library load time | |||||
| #ifdef WIN32 | |||||
| #ifdef __cplusplus | |||||
| extern "C" | |||||
| { | |||||
| #endif | |||||
| BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) | BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) | ||||
| { | { | ||||
| switch (fdwReason) { | switch (fdwReason) { | ||||
| @@ -80,4 +78,32 @@ BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserv | |||||
| } | } | ||||
| #endif | #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; | |||||
| } | |||||
| } | |||||
| #endif | #endif | ||||
| @@ -52,7 +52,7 @@ class JackMutex | |||||
| JackMutex() | JackMutex() | ||||
| { | { | ||||
| // In recursive mode by default | // In recursive mode by default | ||||
| fMutex = CreateMutex(0, FALSE, 0); | |||||
| fMutex = (HANDLE)CreateMutex(0, FALSE, 0); | |||||
| } | } | ||||
| ~JackMutex() | ~JackMutex() | ||||
| { | { | ||||
| @@ -25,6 +25,7 @@ Copyright (C) 2004-2006 Grame | |||||
| #include "JackRequest.h" | #include "JackRequest.h" | ||||
| #include "JackClient.h" | #include "JackClient.h" | ||||
| #include "JackGlobals.h" | #include "JackGlobals.h" | ||||
| #include "JackError.h" | |||||
| namespace Jack | namespace Jack | ||||
| { | { | ||||