Enlightenment CVS committal Author : chaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/common Modified Files: evfs_debug.c Log Message: * Pthread cruft removal =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/common/evfs_debug.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- evfs_debug.c 3 Feb 2006 23:12:13 -0000 1.4 +++ evfs_debug.c 11 Apr 2006 07:01:03 -0000 1.5 @@ -28,30 +28,6 @@ #include "evfs.h" -#if USE_THREADS -#include <pthread.h> - -/* This is a thread-specific call depth register, - and a mutex to lock output for a single thread - at a time. -*/ - -static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_once_t debug_once = PTHREAD_ONCE_INIT; -static pthread_key_t debug_calldepth_key; - -static void debug_once_init(void); -static void debug_destructor(void *item); -#else - -/* We're not using threads -- here's a simple calldepth - variable, and a pointer to it to be code-compatible - to the threaded case. -*/ -static int calldepth = 0; -static void *calldepth_ptr = &calldepth; -#endif - static void debug_whitespace(int calldepth); static void debug_print_thread_info(void); @@ -68,96 +44,4 @@ debug_print_thread_info(void) { printf("evfs "); - -#if USE_THREADS - printf("[%li]: ", pthread_self()); -#else - printf("[%i]: ", getpid()); -#endif -} - -#if USE_THREADS -static void -debug_once_init(void) -{ - pthread_key_create(&debug_calldepth_key, debug_destructor); -} - -static void -debug_destructor(void *item) -{ - free(item); -} -#endif - -void -evfs_debug_output_start(void) -{ -#if USE_THREADS - pthread_mutex_lock(&debug_mutex); -#endif - - debug_print_thread_info(); -} - -void -evfs_debug_output_end(void) -{ - fflush(stdout); - -#if USE_THREADS - pthread_mutex_unlock(&debug_mutex); -#endif -} - -void -evfs_debug_enter(const char *file, const char *func) -{ -#if USE_THREADS - void *calldepth_ptr; - - pthread_once(&debug_once, debug_once_init); - if ((calldepth_ptr = pthread_getspecific(debug_calldepth_key)) == NULL) - { - calldepth_ptr = malloc(sizeof(int)); - *((int *)calldepth_ptr) = 0; - pthread_setspecific(debug_calldepth_key, calldepth_ptr); - } - - pthread_mutex_lock(&debug_mutex); -#endif - - (*((int *)calldepth_ptr))++; - printf("ENTER "); - debug_print_thread_info(); - debug_whitespace(*((int *)calldepth_ptr)); - printf("%s, %s()\n", file, func); - fflush(stdout); - -#if USE_THREADS - pthread_mutex_unlock(&debug_mutex); -#endif -} - -void -evfs_debug_return(const char *file, const char *func) -{ -#if USE_THREADS - void *calldepth_ptr; - - calldepth_ptr = pthread_getspecific(debug_calldepth_key); - pthread_mutex_lock(&debug_mutex); -#endif - - printf("RETURN "); - debug_print_thread_info(); - debug_whitespace(*((int *)calldepth_ptr)); - printf("%s, %s()\n", file, func); - fflush(stdout); - - (*((int *)calldepth_ptr))--; - -#if USE_THREADS - pthread_mutex_unlock(&debug_mutex); -#endif } ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs