1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * This source file is part of SableVM. * 3 * * 4 * See the file "LICENSE" for the copyright information and for * 5 * the terms and conditions for copying, distribution and * 6 * modification of this source file. * 7 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 8 9 #ifndef SVM_THREAD_H 10 #define SVM_THREAD_H 11 12 #define _svmm_mutex_init(mutex) \ 13 pthread_mutex_init (&mutex, NULL) 14 15 #define _svmm_mutex_destroy(mutex) \ 16 pthread_mutex_destroy (&mutex) 17 18 #define _svmm_mutex_lock(mutex) \ 19 { \ 20 pthread_mutex_t *_svmx_pmutex = &mutex; \ 21 pthread_mutex_lock (_svmx_pmutex) 22 23 #define _svmm_mutex_unlock() \ 24 pthread_mutex_unlock (_svmx_pmutex); \ 25 } 26 27 #define _svmm_mutex_trylock(mutex) \ 28 pthread_mutex_trylock(&mutex) 29 30 #define _svmm_mutex_unlock_after_try(mutex) \ 31 pthread_mutex_unlock(&mutex) 32 33 34 #define _svmm_cond_init(cond) \ 35 pthread_cond_init (&cond, NULL) 36 37 #define _svmm_cond_destroy(cond) \ 38 pthread_cond_destroy (&cond) 39 40 #define _svmm_cond_wait(cond, mutex) \ 41 pthread_cond_wait (&cond, &mutex) 42 43 #define _svmm_cond_timedwait(cond, mutex, abstime) \ 44 pthread_cond_timedwait (&cond, &mutex, &abstime) 45 46 #define _svmm_cond_signal(cond) \ 47 pthread_cond_signal (&cond) 48 49 #define _svmm_cond_broadcast(cond) \ 50 pthread_cond_broadcast (&cond) 51 52 #define _svmm_cond_broadcast_ptr(cond) \ 53 pthread_cond_broadcast (cond) 54 55 #define _svmm_kill(thread, signal) \ 56 pthread_kill (thread, signal) 57 58 #define _svmm_enter_object_monitor_non_blocking(env, instance, succeeded) \ 59 _svmh_enter_object_monitor_non_blocking (env, instance, &succeeded) 60 61 static _svmt_JNIEnv *_svmf_get_current_env (void); 62 63 #endif /* not SVM_THREAD_H */ 64