Browse Source

Michael Voigt mutex cleanup patch.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2907 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 15 years ago
parent
commit
f4150108a8
6 changed files with 33 additions and 21 deletions
  1. +2
    -2
      common/JackMutex.h
  2. +7
    -2
      linux/JackPlatformPlug_os.h
  3. +6
    -1
      macosx/JackPlatformPlug_os.h
  4. +7
    -8
      posix/JackPosixMutex.h
  5. +6
    -1
      windows/JackPlatformPlug_os.h
  6. +5
    -7
      windows/JackWinMutex.h

+ 2
- 2
common/JackMutex.h View File

@@ -22,10 +22,10 @@
#ifndef __JackMutex__
#define __JackMutex__

#include "JackMutex_os.h"

#include <assert.h>
#include "JackError.h"
#include "JackPlatformPlug.h"


namespace Jack
{


+ 7
- 2
linux/JackPlatformPlug_os.h View File

@@ -22,9 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

namespace Jack
{
struct JackRequest;
struct JackRequest;
struct JackResult;
class JackPosixMutex;
class JackPosixThread;
class JackFifo;

@@ -36,6 +37,10 @@ namespace Jack
class JackNetUnixSocket;
}

/* __JackPlatformMutex__ */
#include "JackPosixMutex.h"
namespace Jack {typedef JackPosixMutex JackMutex; }

/* __JackPlatformThread__ */
#include "JackPosixThread.h"
namespace Jack { typedef JackPosixThread JackThread; }


+ 6
- 1
macosx/JackPlatformPlug_os.h View File

@@ -21,7 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __JackPlatformPlug_APPLE__

namespace Jack
{
{
class JackPosixMutex;
class JackMachThread;
class JackMachSemaphore;

@@ -32,6 +33,10 @@ namespace Jack
class JackNetUnixSocket;
}

/* __JackPlatformMutex__ */
#include "JackPosixMutex.h"
namespace Jack {typedef JackPosixMutex JackMutex; }

/* __JackPlatformThread__ */
#include "JackMachThread.h"
namespace Jack { typedef JackMachThread JackThread; }


posix/JackMutex_os.h → posix/JackPosixMutex.h View File

@@ -19,8 +19,8 @@
grame@grame.fr
*/

#ifndef __JackMutex_POSIX__
#define __JackMutex_POSIX__
#ifndef __JackPosixMutex__
#define __JackPosixMutex__

#include <pthread.h>

@@ -29,12 +29,11 @@

namespace Jack
{

/*!
\brief Mutex abstraction.
*/

class JackMutex
class JackPosixMutex
{

private:
@@ -43,7 +42,7 @@ class JackMutex

public:

JackMutex()
JackPosixMutex()
{
// Use recursive mutex
pthread_mutexattr_t mutex_attr;
@@ -57,7 +56,7 @@ class JackMutex
res = pthread_mutexattr_destroy(&mutex_attr);
assert(res == 0);
}
~JackMutex()
~JackPosixMutex()
{
pthread_mutex_destroy(&fMutex);
}
@@ -66,7 +65,7 @@ class JackMutex
{
int res = pthread_mutex_lock(&fMutex);
if (res != 0)
jack_error("JackMutex::Lock res = %d", res);
jack_error("JackPosixMutex::Lock res = %d", res);
}

bool Trylock()
@@ -78,7 +77,7 @@ class JackMutex
{
int res = pthread_mutex_unlock(&fMutex);
if (res != 0)
jack_error("JackMutex::Unlock res = %d", res);
jack_error("JackPosixMutex::Unlock res = %d", res);
}

};

+ 6
- 1
windows/JackPlatformPlug_os.h View File

@@ -24,7 +24,8 @@ namespace Jack
{
struct JackRequest;
struct JackResult;

class JackWinMutex;
class JackWinThread;
class JackWinSemaphore;
class JackWinProcessSync;
@@ -36,6 +37,10 @@ namespace Jack
class JackNetWinSocket;
}

/* __JackPlatformMutex__ */
#include "JackWinMutex.h"
namespace Jack {typedef JackWinMutex JackMutex; }

/* __JackPlatformThread__ */
#include "JackWinThread.h"
namespace Jack { typedef JackWinThread JackThread; }


windows/JackMutex_os.h → windows/JackWinMutex.h View File

@@ -19,8 +19,8 @@
grame@grame.fr
*/

#ifndef __JackMutex_WIN32__
#define __JackMutex_WIN32__
#ifndef __JackWinMutex__
#define __JackWinMutex__

#include <windows.h>

@@ -29,12 +29,10 @@

namespace Jack
{

/*!
\brief Mutex abstraction.
*/

class JackMutex
class JackWinMutex
{

private:
@@ -43,12 +41,12 @@ class JackMutex

public:

JackMutex()
JackWinMutex()
{
// In recursive mode by default
fMutex = (HANDLE)CreateMutex(0, FALSE, 0);
}
~JackMutex()
~JackWinMutex()
{
CloseHandle(fMutex);
}

Loading…
Cancel
Save