forked from enlightenment/efl
oops - formatting at start too - not just end
SVN revision: 51510
This commit is contained in:
parent
1974702021
commit
eb1a43bfbf
|
@ -350,39 +350,39 @@ static pthread_t _main_thread;
|
||||||
# define SELF() pthread_self()
|
# define SELF() pthread_self()
|
||||||
# define IS_MAIN(t) pthread_equal(t, _main_thread)
|
# define IS_MAIN(t) pthread_equal(t, _main_thread)
|
||||||
# define IS_OTHER(t) EINA_UNLIKELY(!IS_MAIN(t))
|
# define IS_OTHER(t) EINA_UNLIKELY(!IS_MAIN(t))
|
||||||
# define CHECK_MAIN(...) \
|
# define CHECK_MAIN(...) \
|
||||||
do { \
|
do { \
|
||||||
if (!IS_MAIN(pthread_self())) { \
|
if (!IS_MAIN(pthread_self())) { \
|
||||||
fprintf(stderr, \
|
fprintf(stderr, \
|
||||||
"ERR: not main thread! current=%lu, main=%lu\n", \
|
"ERR: not main thread! current=%lu, main=%lu\n", \
|
||||||
(unsigned long)pthread_self(), \
|
(unsigned long)pthread_self(), \
|
||||||
(unsigned long)_main_thread); \
|
(unsigned long)_main_thread); \
|
||||||
return __VA_ARGS__; \
|
return __VA_ARGS__; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# ifdef EFL_HAVE_POSIX_THREADS_SPINLOCK
|
# ifdef EFL_HAVE_POSIX_THREADS_SPINLOCK
|
||||||
|
|
||||||
static pthread_spinlock_t _log_lock;
|
static pthread_spinlock_t _log_lock;
|
||||||
# define LOG_LOCK() \
|
# define LOG_LOCK() \
|
||||||
if(_threads_enabled) \
|
if (_threads_enabled) \
|
||||||
do { \
|
do { \
|
||||||
if (0) { \
|
if (0) { \
|
||||||
fprintf(stderr, "+++LOG LOG_LOCKED! [%s, %lu]\n", \
|
fprintf(stderr, "+++LOG LOG_LOCKED! [%s, %lu]\n", \
|
||||||
__FUNCTION__, (unsigned long)pthread_self()); } \
|
__FUNCTION__, (unsigned long)pthread_self()); } \
|
||||||
if (EINA_UNLIKELY(_threads_enabled)) { \
|
if (EINA_UNLIKELY(_threads_enabled)) { \
|
||||||
pthread_spin_lock(&_log_lock); } \
|
pthread_spin_lock(&_log_lock); } \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define LOG_UNLOCK() \
|
# define LOG_UNLOCK() \
|
||||||
if(_threads_enabled) \
|
if (_threads_enabled) \
|
||||||
do { \
|
do { \
|
||||||
if (EINA_UNLIKELY(_threads_enabled)) { \
|
if (EINA_UNLIKELY(_threads_enabled)) { \
|
||||||
pthread_spin_unlock(&_log_lock); } \
|
pthread_spin_unlock(&_log_lock); } \
|
||||||
if (0) { \
|
if (0) { \
|
||||||
fprintf(stderr, \
|
fprintf(stderr, \
|
||||||
"---LOG LOG_UNLOCKED! [%s, %lu]\n", \
|
"---LOG LOG_UNLOCKED! [%s, %lu]\n", \
|
||||||
__FUNCTION__, (unsigned long)pthread_self()); } \
|
__FUNCTION__, (unsigned long)pthread_self()); } \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define INIT() pthread_spin_init(&_log_lock, PTHREAD_PROCESS_PRIVATE)
|
# define INIT() pthread_spin_init(&_log_lock, PTHREAD_PROCESS_PRIVATE)
|
||||||
# define SHUTDOWN() pthread_spin_destroy(&_log_lock)
|
# define SHUTDOWN() pthread_spin_destroy(&_log_lock)
|
||||||
|
|
||||||
|
@ -405,15 +405,15 @@ static DWORD _main_thread;
|
||||||
# define SELF() GetCurrentThreadId()
|
# define SELF() GetCurrentThreadId()
|
||||||
# define IS_MAIN(t) (t == _main_thread)
|
# define IS_MAIN(t) (t == _main_thread)
|
||||||
# define IS_OTHER(t) EINA_UNLIKELY(!IS_MAIN(t))
|
# define IS_OTHER(t) EINA_UNLIKELY(!IS_MAIN(t))
|
||||||
# define CHECK_MAIN(...) \
|
# define CHECK_MAIN(...) \
|
||||||
do { \
|
do { \
|
||||||
if (!IS_MAIN(GetCurrentThreadId())) { \
|
if (!IS_MAIN(GetCurrentThreadId())) { \
|
||||||
fprintf(stderr, \
|
fprintf(stderr, \
|
||||||
"ERR: not main thread! current=%lu, main=%lu\n", \
|
"ERR: not main thread! current=%lu, main=%lu\n", \
|
||||||
GetCurrentThreadId(), _main_thread); \
|
GetCurrentThreadId(), _main_thread); \
|
||||||
return __VA_ARGS__; \
|
return __VA_ARGS__; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static HANDLE _log_mutex = NULL;
|
static HANDLE _log_mutex = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue