1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
/*
* File: ErrorContext.h
* Author: Yavor Nikolov
*
* Created on 29 October 2011, 18:14
*/
#ifndef ERRORCONTEXT_H
#define ERRORCONTEXT_H
#include "pbzip2.h"
namespace pbzip2
{
class ErrorContext
{
private:
static ErrorContext * _instance;
static pthread_mutex_t _err_ctx_mutex;
int _first_kernel_err_no;
int _last_kernel_err_no;
private:
ErrorContext():
_first_kernel_err_no( 0 ),
_last_kernel_err_no( 0 )
{
}
ErrorContext( ErrorContext const & s );
void operator=( ErrorContext const & s );
public:
static ErrorContext * getInstance();
void printErrorMessages( FILE * out = stderr );
void saveError();
void reset();
static void printErrnoMsg( FILE * out, int err );
static void syncPrintErrnoMsg( FILE * out, int err );
};
} // namespace pbzip2
#endif /* ERRORCONTEXT_H */
|