/Users/maurits/Documents/studie/afstuderen/biosphere/daemon/mutex.c

Go to the documentation of this file.
00001 #include "mutex.h"
00002 #include <stdio.h>
00003 
00007 static apr_thread_mutex_t *option_mux;
00008 
00012 static apr_thread_mutex_t *pool_mux;
00013 
00017 static apr_thread_mutex_t *module_mux;
00018 
00022 static apr_thread_mutex_t *service_mux;
00023 
00027 static apr_thread_mutex_t *node_mux;
00028 
00032 static apr_thread_mutex_t *thread_mux;
00033 
00034 
00035 bs_status init_mutexes(apr_pool_t *mp)
00036 {
00037         apr_status_t rv;
00038         
00039         rv = apr_thread_mutex_create(&option_mux, APR_THREAD_MUTEX_DEFAULT, mp);
00040     rv += apr_thread_mutex_create(&pool_mux, APR_THREAD_MUTEX_DEFAULT, mp);
00041     rv += apr_thread_mutex_create(&module_mux, APR_THREAD_MUTEX_DEFAULT, mp);
00042     rv += apr_thread_mutex_create(&node_mux, APR_THREAD_MUTEX_DEFAULT, mp);
00043     rv += apr_thread_mutex_create(&service_mux, APR_THREAD_MUTEX_DEFAULT, mp);
00044     rv += apr_thread_mutex_create(&thread_mux, APR_THREAD_MUTEX_DEFAULT, mp);
00045     if (rv != APR_SUCCESS) return BS_ERROR;
00046     
00047     return BS_OK;
00048 }
00049 
00050 
00051 inline void lock_option_mux(void)
00052 {
00053         apr_thread_mutex_lock(option_mux);
00054 }
00055 
00056 
00057 inline void unlock_option_mux(void)
00058 {
00059         apr_thread_mutex_unlock(option_mux);
00060 }
00061 
00062 
00063 inline void lock_pool_mux(void)
00064 {
00065         apr_thread_mutex_lock(pool_mux);        
00066 }
00067 
00068 
00069 inline void unlock_pool_mux(void)
00070 {
00071         apr_thread_mutex_unlock(pool_mux);
00072 }
00073 
00074 
00075 inline void lock_module_mux(void)
00076 {
00077         apr_thread_mutex_lock(module_mux);
00078 }
00079 
00080 
00081 inline void unlock_module_mux(void)
00082 {
00083         apr_thread_mutex_unlock(module_mux);
00084 }
00085 
00086 
00087 inline void lock_service_mux(void)
00088 {
00089         apr_thread_mutex_lock(service_mux);
00090 }
00091 
00092 
00093 inline void unlock_service_mux(void)
00094 {
00095         apr_thread_mutex_unlock(service_mux);
00096 }
00097 
00098 
00099 inline void lock_node_mux(void)
00100 {
00101         apr_thread_mutex_lock(node_mux);
00102 }
00103 
00104 
00105 inline void unlock_node_mux(void)
00106 {
00107         apr_thread_mutex_unlock(node_mux);
00108 }
00109 
00110 inline void lock_thread_mux(void)
00111 {
00112         apr_thread_mutex_lock(thread_mux);
00113 }
00114 
00115 
00116 inline void unlock_thread_mux(void)
00117 {
00118         apr_thread_mutex_unlock(thread_mux);
00119 }

Generated on Tue Jul 17 09:50:52 2007 for Bio-SPHERE by  doxygen 1.5.1