mirror of https://github.com/sipwise/jitsi.git
parent
3d4463838b
commit
6c2a8919d2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
#ifndef _NET_JAVA_SIP_COMMUNICATOR_IMPL_NEOMEDIA_CONDITIONVARIABLE_H_
|
||||
#define _NET_JAVA_SIP_COMMUNICATOR_IMPL_NEOMEDIA_CONDITIONVARIABLE_H_
|
||||
|
||||
#include "Mutex.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
typedef HANDLE ConditionVariable;
|
||||
|
||||
static inline void ConditionVariable_free(ConditionVariable *condVar)
|
||||
{
|
||||
if (CloseHandle(*condVar))
|
||||
free(condVar);
|
||||
}
|
||||
|
||||
static inline ConditionVariable *ConditionVariable_new(void *attr)
|
||||
{
|
||||
ConditionVariable *condVar = malloc(sizeof(ConditionVariable));
|
||||
|
||||
if (condVar)
|
||||
{
|
||||
HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
|
||||
if (event)
|
||||
*condVar = event;
|
||||
else
|
||||
{
|
||||
free(condVar);
|
||||
condVar = NULL;
|
||||
}
|
||||
}
|
||||
return condVar;
|
||||
}
|
||||
|
||||
static inline int ConditionVariable_notify(ConditionVariable *condVar)
|
||||
{
|
||||
return SetEvent(*condVar) ? 0 : GetLastError();
|
||||
}
|
||||
|
||||
static inline int ConditionVariable_wait
|
||||
(ConditionVariable *condVar, Mutex *mutex)
|
||||
{
|
||||
DWORD waitForSingleObject;
|
||||
|
||||
LeaveCriticalSection(mutex);
|
||||
waitForSingleObject = WaitForSingleObject(*condVar, INFINITE);
|
||||
EnterCriticalSection(mutex);
|
||||
return waitForSingleObject;
|
||||
}
|
||||
|
||||
#else /* #ifdef _WIN32 */
|
||||
#include <pthread.h>
|
||||
|
||||
typedef pthread_cond_t ConditionVariable;
|
||||
|
||||
static inline void ConditionVariable_free(ConditionVariable *condVar)
|
||||
{
|
||||
if (!pthread_cond_destroy(condVar))
|
||||
free(condVar);
|
||||
}
|
||||
|
||||
static inline ConditionVariable *ConditionVariable_new(void *attr)
|
||||
{
|
||||
ConditionVariable *condVar = malloc(sizeof(ConditionVariable));
|
||||
|
||||
if (condVar && pthread_cond_init(condVar, attr))
|
||||
{
|
||||
free(condVar);
|
||||
condVar = NULL;
|
||||
}
|
||||
return condVar;
|
||||
}
|
||||
|
||||
static inline int ConditionVariable_notify(ConditionVariable *condVar)
|
||||
{
|
||||
return pthread_cond_signal(condVar);
|
||||
}
|
||||
|
||||
static inline int ConditionVariable_wait
|
||||
(ConditionVariable *condVar, Mutex *mutex)
|
||||
{
|
||||
return pthread_cond_wait(condVar, mutex);
|
||||
}
|
||||
#endif /* #ifdef _WIN32 */
|
||||
|
||||
#endif /* _NET_JAVA_SIP_COMMUNICATOR_IMPL_NEOMEDIA_CONDITIONVARIABLE_H_ */
|
||||
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
#ifndef _NET_JAVA_SIP_COMMUNICATOR_IMPL_NEOMEDIA_PORTAUDIO_MUTEX_H_
|
||||
#define _NET_JAVA_SIP_COMMUNICATOR_IMPL_NEOMEDIA_PORTAUDIO_MUTEX_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
typedef CRITICAL_SECTION Mutex;
|
||||
|
||||
static inline void Mutex_free(Mutex* mutex)
|
||||
{
|
||||
DeleteCriticalSection(mutex);
|
||||
free(mutex);
|
||||
}
|
||||
|
||||
static inline int Mutex_lock(Mutex* mutex)
|
||||
{
|
||||
EnterCriticalSection(mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline Mutex *Mutex_new(void* attr)
|
||||
{
|
||||
Mutex *mutex = malloc(sizeof(Mutex));
|
||||
|
||||
(void) attr;
|
||||
|
||||
if (mutex)
|
||||
InitializeCriticalSection(mutex);
|
||||
return mutex;
|
||||
}
|
||||
|
||||
static inline int Mutex_unlock(Mutex* mutex)
|
||||
{
|
||||
LeaveCriticalSection(mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* #ifdef _WIN32 */
|
||||
#include <pthread.h>
|
||||
|
||||
typedef pthread_mutex_t Mutex;
|
||||
|
||||
static inline void Mutex_free(Mutex* mutex)
|
||||
{
|
||||
if (!pthread_mutex_destroy(mutex))
|
||||
free(mutex);
|
||||
}
|
||||
|
||||
static inline int Mutex_lock(Mutex* mutex)
|
||||
{
|
||||
return pthread_mutex_lock(mutex);
|
||||
}
|
||||
|
||||
static inline Mutex *Mutex_new(void* attr)
|
||||
{
|
||||
Mutex *mutex = malloc(sizeof(Mutex));
|
||||
|
||||
if (mutex && pthread_mutex_init(mutex, attr))
|
||||
{
|
||||
free(mutex);
|
||||
mutex = NULL;
|
||||
}
|
||||
return mutex;
|
||||
}
|
||||
|
||||
static inline int Mutex_unlock(Mutex* mutex)
|
||||
{
|
||||
return pthread_mutex_unlock(mutex);
|
||||
}
|
||||
#endif /* #ifdef _WIN32 */
|
||||
|
||||
#endif /* #ifndef _NET_JAVA_SIP_COMMUNICATOR_IMPL_NEOMEDIA_PORTAUDIO_MUTEX_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue