* hb_lock_init() * hb_lock_close() * hb_lock() * hb_unlock() ************************************************************************ * Basic wrappers to OS-specific semaphore or mutex functions. ***********************************************************************/
| 1096 | * Basic wrappers to OS-specific semaphore or mutex functions. |
| 1097 | ***********************************************************************/ |
| 1098 | hb_lock_t * hb_lock_init() |
| 1099 | { |
| 1100 | hb_lock_t * l = calloc( sizeof( hb_lock_t ), 1 ); |
| 1101 | |
| 1102 | pthread_mutexattr_t mta; |
| 1103 | |
| 1104 | pthread_mutexattr_init(&mta); |
| 1105 | |
| 1106 | #if defined( SYS_CYGWIN ) || defined( SYS_FREEBSD ) || defined( SYS_NETBSD ) || \ |
| 1107 | defined( SYS_OPENBSD ) |
| 1108 | pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_NORMAL); |
| 1109 | #endif |
| 1110 | |
| 1111 | pthread_mutex_init( &l->mutex, &mta ); |
| 1112 | |
| 1113 | return l; |
| 1114 | } |
| 1115 | |
| 1116 | void hb_lock_close( hb_lock_t ** _l ) |
| 1117 | { |
no outgoing calls
no test coverage detected