From 7aa6c12a4424d00ea0add0a849f8a5b31a2de6a1 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Sat, 28 Aug 2010 20:14:36 +0200 Subject: Clean-up: Remove pthread and mutex locking code This code was not activated at all, and hard coded as disabled in syshead.h with this code snippet: /* * Pthread support is currently experimental (and quite unfinished). */ #if 1 /* JYFIXME -- if defined, disable pthread */ #undef USE_PTHREAD #endif So no matter if --enable-pthread when running ./configure or not, this feature was never enabled in reality. Further, by removing the blocker code above made OpenVPN uncompilable in the current state. As the threading part needs to be completely rewritten and pthreading will not be supported in OpenVPN 2.x, removing this code seems most reasonable. In addition, a lot of mutex locking code was also removed, as they were practically NOP functions, due to pthreading being forcefully disabled Signed-off-by: David Sommerseth Acked-by: James Yonan --- error.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 603796a..2dfb978 100644 --- a/error.c +++ b/error.c @@ -26,7 +26,6 @@ #include "error.h" #include "buffer.h" -#include "thread.h" #include "misc.h" #include "win32.h" #include "socket.h" @@ -229,8 +228,6 @@ void x_msg (const unsigned int flags, const char *format, ...) gc_init (&gc); - mutex_lock_static (L_MSG); - m1 = (char *) gc_malloc (ERR_BUF_SIZE, false, &gc); m2 = (char *) gc_malloc (ERR_BUF_SIZE, false, &gc); @@ -330,22 +327,12 @@ void x_msg (const unsigned int flags, const char *format, ...) } else { -#ifdef USE_PTHREAD - fprintf (fp, "%s [%d] %s%s%s%s", - time_string (0, 0, show_usec, &gc), - (int) openvpn_thread_self (), - prefix, - prefix_sep, - m1, - (flags&M_NOLF) ? "" : "\n"); -#else fprintf (fp, "%s %s%s%s%s", time_string (0, 0, show_usec, &gc), prefix, prefix_sep, m1, (flags&M_NOLF) ? "" : "\n"); -#endif } fflush(fp); ++x_msg_line_num; @@ -355,8 +342,6 @@ void x_msg (const unsigned int flags, const char *format, ...) if (flags & M_FATAL) msg (M_INFO, "Exiting"); - mutex_unlock_static (L_MSG); - if (flags & M_FATAL) openvpn_exit (OPENVPN_EXIT_STATUS_ERROR); /* exit point */ @@ -645,36 +630,12 @@ x_check_status (int status, */ const char *x_msg_prefix; /* GLOBAL */ -#ifdef USE_PTHREAD -pthread_key_t x_msg_prefix_key; /* GLOBAL */ -#endif - /* * Allow MSG to be redirected through a virtual_output object */ const struct virtual_output *x_msg_virtual_output; /* GLOBAL */ -/* - * Init thread-local variables - */ - -void -msg_thread_init (void) -{ -#ifdef USE_PTHREAD - ASSERT (!pthread_key_create (&x_msg_prefix_key, NULL)); -#endif -} - -void -msg_thread_uninit (void) -{ -#ifdef USE_PTHREAD - pthread_key_delete (x_msg_prefix_key); -#endif -} - /* * Exiting. */ -- cgit v1.2.3