git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2907 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
| @@ -22,10 +22,10 @@ | |||||
| #ifndef __JackMutex__ | #ifndef __JackMutex__ | ||||
| #define __JackMutex__ | #define __JackMutex__ | ||||
| #include "JackMutex_os.h" | |||||
| #include <assert.h> | #include <assert.h> | ||||
| #include "JackError.h" | #include "JackError.h" | ||||
| #include "JackPlatformPlug.h" | |||||
| namespace Jack | namespace Jack | ||||
| { | { | ||||
| @@ -22,9 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
| namespace Jack | namespace Jack | ||||
| { | { | ||||
| struct JackRequest; | |||||
| struct JackRequest; | |||||
| struct JackResult; | struct JackResult; | ||||
| class JackPosixMutex; | |||||
| class JackPosixThread; | class JackPosixThread; | ||||
| class JackFifo; | class JackFifo; | ||||
| @@ -36,6 +37,10 @@ namespace Jack | |||||
| class JackNetUnixSocket; | class JackNetUnixSocket; | ||||
| } | } | ||||
| /* __JackPlatformMutex__ */ | |||||
| #include "JackPosixMutex.h" | |||||
| namespace Jack {typedef JackPosixMutex JackMutex; } | |||||
| /* __JackPlatformThread__ */ | /* __JackPlatformThread__ */ | ||||
| #include "JackPosixThread.h" | #include "JackPosixThread.h" | ||||
| namespace Jack { typedef JackPosixThread JackThread; } | namespace Jack { typedef JackPosixThread JackThread; } | ||||
| @@ -21,7 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
| #define __JackPlatformPlug_APPLE__ | #define __JackPlatformPlug_APPLE__ | ||||
| namespace Jack | namespace Jack | ||||
| { | |||||
| { | |||||
| class JackPosixMutex; | |||||
| class JackMachThread; | class JackMachThread; | ||||
| class JackMachSemaphore; | class JackMachSemaphore; | ||||
| @@ -32,6 +33,10 @@ namespace Jack | |||||
| class JackNetUnixSocket; | class JackNetUnixSocket; | ||||
| } | } | ||||
| /* __JackPlatformMutex__ */ | |||||
| #include "JackPosixMutex.h" | |||||
| namespace Jack {typedef JackPosixMutex JackMutex; } | |||||
| /* __JackPlatformThread__ */ | /* __JackPlatformThread__ */ | ||||
| #include "JackMachThread.h" | #include "JackMachThread.h" | ||||
| namespace Jack { typedef JackMachThread JackThread; } | namespace Jack { typedef JackMachThread JackThread; } | ||||
| @@ -19,8 +19,8 @@ | |||||
| grame@grame.fr | grame@grame.fr | ||||
| */ | */ | ||||
| #ifndef __JackMutex_POSIX__ | |||||
| #define __JackMutex_POSIX__ | |||||
| #ifndef __JackPosixMutex__ | |||||
| #define __JackPosixMutex__ | |||||
| #include <pthread.h> | #include <pthread.h> | ||||
| @@ -29,12 +29,11 @@ | |||||
| namespace Jack | namespace Jack | ||||
| { | { | ||||
| /*! | /*! | ||||
| \brief Mutex abstraction. | \brief Mutex abstraction. | ||||
| */ | */ | ||||
| class JackMutex | |||||
| class JackPosixMutex | |||||
| { | { | ||||
| private: | private: | ||||
| @@ -43,7 +42,7 @@ class JackMutex | |||||
| public: | public: | ||||
| JackMutex() | |||||
| JackPosixMutex() | |||||
| { | { | ||||
| // Use recursive mutex | // Use recursive mutex | ||||
| pthread_mutexattr_t mutex_attr; | pthread_mutexattr_t mutex_attr; | ||||
| @@ -57,7 +56,7 @@ class JackMutex | |||||
| res = pthread_mutexattr_destroy(&mutex_attr); | res = pthread_mutexattr_destroy(&mutex_attr); | ||||
| assert(res == 0); | assert(res == 0); | ||||
| } | } | ||||
| ~JackMutex() | |||||
| ~JackPosixMutex() | |||||
| { | { | ||||
| pthread_mutex_destroy(&fMutex); | pthread_mutex_destroy(&fMutex); | ||||
| } | } | ||||
| @@ -66,7 +65,7 @@ class JackMutex | |||||
| { | { | ||||
| int res = pthread_mutex_lock(&fMutex); | int res = pthread_mutex_lock(&fMutex); | ||||
| if (res != 0) | if (res != 0) | ||||
| jack_error("JackMutex::Lock res = %d", res); | |||||
| jack_error("JackPosixMutex::Lock res = %d", res); | |||||
| } | } | ||||
| bool Trylock() | bool Trylock() | ||||
| @@ -78,7 +77,7 @@ class JackMutex | |||||
| { | { | ||||
| int res = pthread_mutex_unlock(&fMutex); | int res = pthread_mutex_unlock(&fMutex); | ||||
| if (res != 0) | if (res != 0) | ||||
| jack_error("JackMutex::Unlock res = %d", res); | |||||
| jack_error("JackPosixMutex::Unlock res = %d", res); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -24,7 +24,8 @@ namespace Jack | |||||
| { | { | ||||
| struct JackRequest; | struct JackRequest; | ||||
| struct JackResult; | struct JackResult; | ||||
| class JackWinMutex; | |||||
| class JackWinThread; | class JackWinThread; | ||||
| class JackWinSemaphore; | class JackWinSemaphore; | ||||
| class JackWinProcessSync; | class JackWinProcessSync; | ||||
| @@ -36,6 +37,10 @@ namespace Jack | |||||
| class JackNetWinSocket; | class JackNetWinSocket; | ||||
| } | } | ||||
| /* __JackPlatformMutex__ */ | |||||
| #include "JackWinMutex.h" | |||||
| namespace Jack {typedef JackWinMutex JackMutex; } | |||||
| /* __JackPlatformThread__ */ | /* __JackPlatformThread__ */ | ||||
| #include "JackWinThread.h" | #include "JackWinThread.h" | ||||
| namespace Jack { typedef JackWinThread JackThread; } | namespace Jack { typedef JackWinThread JackThread; } | ||||
| @@ -19,8 +19,8 @@ | |||||
| grame@grame.fr | grame@grame.fr | ||||
| */ | */ | ||||
| #ifndef __JackMutex_WIN32__ | |||||
| #define __JackMutex_WIN32__ | |||||
| #ifndef __JackWinMutex__ | |||||
| #define __JackWinMutex__ | |||||
| #include <windows.h> | #include <windows.h> | ||||
| @@ -29,12 +29,10 @@ | |||||
| namespace Jack | namespace Jack | ||||
| { | { | ||||
| /*! | /*! | ||||
| \brief Mutex abstraction. | \brief Mutex abstraction. | ||||
| */ | */ | ||||
| class JackMutex | |||||
| class JackWinMutex | |||||
| { | { | ||||
| private: | private: | ||||
| @@ -43,12 +41,12 @@ class JackMutex | |||||
| public: | public: | ||||
| JackMutex() | |||||
| JackWinMutex() | |||||
| { | { | ||||
| // In recursive mode by default | // In recursive mode by default | ||||
| fMutex = (HANDLE)CreateMutex(0, FALSE, 0); | fMutex = (HANDLE)CreateMutex(0, FALSE, 0); | ||||
| } | } | ||||
| ~JackMutex() | |||||
| ~JackWinMutex() | |||||
| { | { | ||||
| CloseHandle(fMutex); | CloseHandle(fMutex); | ||||
| } | } | ||||