summaryrefslogtreecommitdiffstats
path: root/common.cc
diff options
context:
space:
mode:
Diffstat (limited to 'common.cc')
-rw-r--r--common.cc25
1 files changed, 10 insertions, 15 deletions
diff --git a/common.cc b/common.cc
index 22958ec..a493e11 100644
--- a/common.cc
+++ b/common.cc
@@ -19,31 +19,26 @@
#include <cctype>
#include <cerrno>
-#include <climits>
#include <cstdlib>
-#include <cstring>
-#include <string>
-#include <vector>
#include <pthread.h>
-#include <stdint.h>
#include <unistd.h>
-#include "arg_parser.h"
#include "tarlz.h"
+#include "arg_parser.h"
void xinit_mutex( pthread_mutex_t * const mutex )
{
const int errcode = pthread_mutex_init( mutex, 0 );
if( errcode )
- { show_error( "pthread_mutex_init", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_mutex_init", errcode ); exit_fail_mt(); }
}
void xinit_cond( pthread_cond_t * const cond )
{
const int errcode = pthread_cond_init( cond, 0 );
if( errcode )
- { show_error( "pthread_cond_init", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_cond_init", errcode ); exit_fail_mt(); }
}
@@ -51,14 +46,14 @@ void xdestroy_mutex( pthread_mutex_t * const mutex )
{
const int errcode = pthread_mutex_destroy( mutex );
if( errcode )
- { show_error( "pthread_mutex_destroy", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_mutex_destroy", errcode ); exit_fail_mt(); }
}
void xdestroy_cond( pthread_cond_t * const cond )
{
const int errcode = pthread_cond_destroy( cond );
if( errcode )
- { show_error( "pthread_cond_destroy", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_cond_destroy", errcode ); exit_fail_mt(); }
}
@@ -66,7 +61,7 @@ void xlock( pthread_mutex_t * const mutex )
{
const int errcode = pthread_mutex_lock( mutex );
if( errcode )
- { show_error( "pthread_mutex_lock", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_mutex_lock", errcode ); exit_fail_mt(); }
}
@@ -74,7 +69,7 @@ void xunlock( pthread_mutex_t * const mutex )
{
const int errcode = pthread_mutex_unlock( mutex );
if( errcode )
- { show_error( "pthread_mutex_unlock", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_mutex_unlock", errcode ); exit_fail_mt(); }
}
@@ -82,7 +77,7 @@ void xwait( pthread_cond_t * const cond, pthread_mutex_t * const mutex )
{
const int errcode = pthread_cond_wait( cond, mutex );
if( errcode )
- { show_error( "pthread_cond_wait", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_cond_wait", errcode ); exit_fail_mt(); }
}
@@ -90,7 +85,7 @@ void xsignal( pthread_cond_t * const cond )
{
const int errcode = pthread_cond_signal( cond );
if( errcode )
- { show_error( "pthread_cond_signal", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_cond_signal", errcode ); exit_fail_mt(); }
}
@@ -98,7 +93,7 @@ void xbroadcast( pthread_cond_t * const cond )
{
const int errcode = pthread_cond_broadcast( cond );
if( errcode )
- { show_error( "pthread_cond_broadcast", errcode ); cleanup_and_fail(); }
+ { show_error( "pthread_cond_broadcast", errcode ); exit_fail_mt(); }
}