Ejemplo n.º 1
0
BOOL cg_mutex_lock(CgMutex *mutex)
{
	if (!mutex)
		return FALSE;

	cg_log_debug_l4("Entering...\n");

#if defined(WIN32) && !defined(ITRON)
	WaitForSingleObject(mutex->mutexID, INFINITE);
#elif defined(BTRON)
	wai_sem(mutex->mutexID, T_FOREVER);
#elif defined(ITRON)
	twai_sem(mutex->mutexID, TMO_FEVR);
#elif defined(TENGINE) && !defined(PROCESS_BASE)
	tk_wai_sem(mutex->mutexID, 1, TMO_FEVR);
#elif defined(TENGINE) && defined(PROCESS_BASE)
	b_wai_sem(mutex->mutexID, T_FOREVER);
#else
	pthread_mutex_lock(&mutex->mutexID);
#endif

	cg_log_debug_l4("Leaving...\n");

	return TRUE;
}
Ejemplo n.º 2
0
bool mupnp_mutex_lock(mUpnpMutex *mutex)
{
	if (!mutex)
		return false;

	mupnp_log_debug_l4("Entering...\n");

#if defined(WIN32) && !defined(ITRON)
	WaitForSingleObject(mutex->mutexID, INFINITE);
#elif defined(BTRON)
	wai_sem(mutex->mutexID, T_FOREVER);
#elif defined(ITRON)
	twai_sem(mutex->mutexID, TMO_FEVR);
#elif defined(TENGINE) && !defined(PROCESS_BASE)
	tk_wai_sem(mutex->mutexID, 1, TMO_FEVR);
#elif defined(TENGINE) && defined(PROCESS_BASE)
	b_wai_sem(mutex->mutexID, T_FOREVER);
#else
	pthread_mutex_lock(&mutex->mutexID);
#endif

	mupnp_log_debug_l4("Leaving...\n");

	return true;
}
Ejemplo n.º 3
0
int knh_mutex_lock(kmutex_t *m)
{
	//DBG_P("locking %p", m);
#if defined(K_USING_PTHREAD)
	int ret = pthread_mutex_lock((pthread_mutex_t*)m);
	return ret;
#elif defined(K_USING_BTRON)
	W err = b_wai_sem(*m, T_FOREVER);
	if (err < 0) {
		return -1;
	}
	return 0;
#elif defined(K_USED_TO_BE_ON_LKM)
	mutex_lock((struct mutex *) m);
	return 0;
#elif defined(K_USING_WINTHREAD_)
	EnterCriticalSection(m);
	return 0;
#else
	return 0;
#endif
}