New LockAllMemory and UnlockAllMemory functions.
[jack2.git] / macosx / JackMachSemaphore.h
blob465d4b0ff72f2e96d20af4bb2128b6b7bc52ccd5
1 /*
2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackMacSemaphore__
21 #define __JackMacSemaphore__
23 #include "JackSynchro.h"
24 #include <mach/mach.h>
25 #include <mach/mach_types.h>
26 #include <mach/message.h>
27 #include <mach/mach_error.h>
28 #include <servers/bootstrap.h>
29 #include <mach/semaphore.h>
31 namespace Jack
34 /*!
35 \brief Inter process synchronization using using Mach semaphore.
38 class JackMachSemaphore : public JackSynchro
41 private:
43 semaphore_t fSemaphore;
44 static mach_port_t fBootPort;
46 protected:
48 void BuildName(const char* name, char* res);
50 public:
52 JackMachSemaphore(): JackSynchro(), fSemaphore(0)
54 virtual ~JackMachSemaphore()
57 bool Signal();
58 bool SignalAll();
59 bool Wait();
60 bool TimedWait(long usec);
62 bool Allocate(const char* name, int value);
63 bool Connect(const char* name);
64 bool ConnectInput(const char* name);
65 bool ConnectOutput(const char* name);
66 bool Disconnect();
67 void Destroy();
71 } // end of namespace
74 #endif