|
|
|
@ -28,14 +28,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <elog.h>
|
|
|
|
#include <elog.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ELOG_FILE_ENABLE
|
|
|
|
#ifdef ELOG_FILE_ENABLE
|
|
|
|
#include <elog_file.h>
|
|
|
|
#include <elog_file.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static pthread_mutex_t output_lock;
|
|
|
|
static HANDLE output_lock = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* EasyLogger port initialize
|
|
|
|
* EasyLogger port initialize
|
|
|
|
@ -45,7 +44,7 @@ static pthread_mutex_t output_lock;
|
|
|
|
ElogErrCode elog_port_init(void) {
|
|
|
|
ElogErrCode elog_port_init(void) {
|
|
|
|
ElogErrCode result = ELOG_NO_ERR;
|
|
|
|
ElogErrCode result = ELOG_NO_ERR;
|
|
|
|
|
|
|
|
|
|
|
|
pthread_mutex_init(&output_lock, NULL);
|
|
|
|
output_lock = CreateMutex(NULL, FALSE, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ELOG_FILE_ENABLE
|
|
|
|
#ifdef ELOG_FILE_ENABLE
|
|
|
|
elog_file_init();
|
|
|
|
elog_file_init();
|
|
|
|
@ -73,14 +72,14 @@ void elog_port_output(const char *log, size_t size) {
|
|
|
|
* output lock
|
|
|
|
* output lock
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void elog_port_output_lock(void) {
|
|
|
|
void elog_port_output_lock(void) {
|
|
|
|
pthread_mutex_lock(&output_lock);
|
|
|
|
WaitForSingleObject(output_lock, INFINITE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* output unlock
|
|
|
|
* output unlock
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void elog_port_output_unlock(void) {
|
|
|
|
void elog_port_output_unlock(void) {
|
|
|
|
pthread_mutex_unlock(&output_lock);
|
|
|
|
ReleaseMutex( output_lock );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|