| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #if HAVE_CONFIG_H |
| # include <config.h> |
| #endif |
| |
| #include <complib/cl_types.h> |
| #include <complib/cl_debug.h> |
| #include <complib/cl_spinlock.h> |
| |
| #include <stdio.h> |
| #include <unistd.h> |
| #include <stdlib.h> |
| |
| |
| |
| |
| |
| extern cl_status_t __cl_timer_prov_create(void); |
| |
| extern void __cl_timer_prov_destroy(void); |
| |
| cl_spinlock_t cl_atomic_spinlock; |
| |
| void complib_init(void) |
| { |
| cl_status_t status = CL_SUCCESS; |
| |
| status = cl_spinlock_init(&cl_atomic_spinlock); |
| if (status != CL_SUCCESS) |
| goto _error; |
| |
| status = __cl_timer_prov_create(); |
| if (status != CL_SUCCESS) |
| goto _error; |
| return; |
| |
| _error: |
| cl_msg_out("__init: failed to create complib (%s)\n", |
| CL_STATUS_MSG(status)); |
| exit(1); |
| } |
| |
| cl_status_t complib_init_v2(void) |
| { |
| cl_status_t status = CL_SUCCESS; |
| |
| status = cl_spinlock_init(&cl_atomic_spinlock); |
| if (status != CL_SUCCESS) |
| goto _error; |
| |
| status = __cl_timer_prov_create(); |
| if (status != CL_SUCCESS) |
| goto _error; |
| return status; |
| |
| _error: |
| cl_msg_out("__init_v2: failed to create complib (%s)\n", |
| CL_STATUS_MSG(status)); |
| return status; |
| } |
| |
| void complib_exit(void) |
| { |
| __cl_timer_prov_destroy(); |
| cl_spinlock_destroy(&cl_atomic_spinlock); |
| } |
| |
| boolean_t cl_is_debug(void) |
| { |
| #if defined( _DEBUG_ ) |
| return TRUE; |
| #else |
| return FALSE; |
| #endif |
| } |