Adding upstream version 0.21.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
7bf1f2e322
commit
cc1b855cb3
27 changed files with 961 additions and 324 deletions
25
common.cc
25
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(); }
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue