2 Copyright (C) 2004-2008 Grame
3 Copyright (C) 2013 Samsung Electronics
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef __JackAndroidSemaphore__
22 #define __JackAndroidSemaphore__
24 #include "JackSynchro.h"
25 #include "JackCompilerDeps.h"
26 #include <semaphore.h>
30 #include <binder/IMemory.h>
31 #include <binder/MemoryHeapBase.h>
32 #include <utils/RefBase.h>
38 \brief Inter process synchronization using POSIX semaphore.
41 class SERVER_EXPORT JackAndroidSemaphore
: public detail::JackSynchro
47 android::sp
<android::IMemoryHeap
> fSemaphoreMemory
;
48 static pthread_mutex_t mutex
;
52 void BuildName(const char* name
, const char* server_name
, char* res
, int size
);
56 JackAndroidSemaphore():JackSynchro(), fSemaphore(NULL
)
62 bool TimedWait(long usec
);
64 bool Allocate(const char* name
, const char* server_name
, int value
);
65 bool Connect(const char* name
, const char* server_name
);
66 bool ConnectInput(const char* name
, const char* server_name
);
67 bool ConnectOutput(const char* name
, const char* server_name
);