Exemplo n.º 1
0
status_t
_user_mutex_lock(int32* mutex, const char* name, uint32 flags,
	bigtime_t timeout)
{
	if (mutex == NULL || !IS_USER_ADDRESS(mutex) || (addr_t)mutex % 4 != 0)
		return B_BAD_ADDRESS;

	syscall_restart_handle_timeout_pre(flags, timeout);

	status_t error = user_mutex_lock(mutex, name, flags | B_CAN_INTERRUPT,
		timeout);

	return syscall_restart_handle_timeout_post(error, timeout);
}
Exemplo n.º 2
0
int user_cond_wait(user_cond_t *cond, user_mutex_t *mutex) {
#ifdef WITH_REALTIME_THREADS
  if (handlerMask&javax_realtime_Scheduler_HANDLE_COND_WAIT) {
    JNIEnv* env = FNI_GetJNIEnv();
    (*env)->CallStaticVoidMethod(env, SchedulerClaz, Scheduler_handle_cond_wait);
#ifdef WITH_REALTIME_THREADS_DEBUG
    fflush(NULL);
    assert(!((*env)->ExceptionOccurred(env)));
#endif
  }
#endif
  /*Only one thread so this will work...*/
  user_mutex_unlock(mutex);
  /*Previous 2 lines need to be atomic!!!!*/
  addcontthread(cond);
  /*grab the lock again*/
  user_mutex_lock(mutex);
  return 0;
}