diff --git a/src/main.c b/src/main.c
index cc592238d6054c6a58778b9478f50012dbdbe781..ce6e919f9a84f7e83ada0c7aa7a8176ef408c1f8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -18,16 +18,18 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-/* implementations of OpenOCD that uses multithreading needs to lock OpenOCD while calling
- * OpenOCD fn's. No-op in vanilla OpenOCD
+/* implementations of OpenOCD that uses multithreading needs to know when
+ * OpenOCD is sleeping. No-op in vanilla OpenOCD
  */
-void lockBigLock()
+void openocd_sleep_prelude()
 {
 }
-void unlockBigLock()
+
+void openocd_sleep_postlude()
 {
 }
 
+
 /* 
 	This is the main entry for developer PC hosted OpenOCD.
 	
@@ -47,3 +49,4 @@ int main(int argc, char *argv[])
 	return openocd_main(argc, argv);
 }
 
+
diff --git a/src/openocd.c b/src/openocd.c
index ee00f19adb2e7b67c94eefaef74192e5476fef74..834b11d92fbb6c409261a010805b6118ecaba1d1 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -185,8 +185,6 @@ int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
 	return ERROR_OK;
 }
 
-void lockBigLock();
-void unlockBigLock();
 
 Jim_Interp *interp;
 command_context_t *active_cmd_ctx;
@@ -445,8 +443,6 @@ static int Jim_Command_openocd_ignore(Jim_Interp *interp, int argc, Jim_Obj *con
 	int retval;
     char *cmd = (char*)Jim_GetString(argv[1], NULL);
 
-	lockBigLock();
-	
     Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
     
     if (startLoop)
@@ -465,7 +461,6 @@ static int Jim_Command_openocd_ignore(Jim_Interp *interp, int argc, Jim_Obj *con
 	log_remove_callback(tcl_output, tclOutput);
     
 	Jim_SetResult(interp, tclOutput);
-    unlockBigLock();
         
     return (ignore||(retval==ERROR_OK))?JIM_OK:JIM_ERR;
 }
diff --git a/src/server/server.c b/src/server/server.c
index fb003624e6507d9fdaa2f1c97fab13edc0aa3b36..2d910a1ab0ee9bc5d794253046dca642f6ad29cb 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -246,8 +246,8 @@ int remove_services()
 	return ERROR_OK;
 }
 
-extern void lockBigLock();
-extern void unlockBigLock();
+extern void openocd_sleep_prelude();
+extern void openocd_sleep_postlude();
 
 int server_loop(command_context_t *command_context)
 {
@@ -266,13 +266,6 @@ int server_loop(command_context_t *command_context)
 		LOG_ERROR("couldn't set SIGPIPE to SIG_IGN");
 #endif
 
-	// This function is reentrant(workaround for configuration problems)
-	static int lockCount=0;
-	if (lockCount++==0)
-	{
-		lockBigLock();
-	}
-	
 	/* do regular tasks after at most 10ms */
 	tv.tv_sec = 0;
 	tv.tv_usec = 10000;
@@ -316,10 +309,10 @@ int server_loop(command_context_t *command_context)
 #endif
 #endif
 
+		openocd_sleep_prelude();
 		// Only while we're sleeping we'll let others run
-		unlockBigLock();
 		retval = select(fd_max + 1, &read_fds, NULL, NULL, &tv);
-		lockBigLock();
+		openocd_sleep_postlude();
 
 		if (retval == -1)
 		{
@@ -421,10 +414,6 @@ int server_loop(command_context_t *command_context)
 		}
 #endif
 	}
-	if (--lockCount==0)
-	{
-		unlockBigLock();
-	}
 	
 	return ERROR_OK;
 }
@@ -462,6 +451,7 @@ int server_init()
 	signal(SIGBREAK, sig_handler);
 	signal(SIGABRT, sig_handler);
 #endif
+
 	
 	return ERROR_OK;
 }
@@ -493,3 +483,5 @@ int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char *
 
 	return ERROR_COMMAND_CLOSE_CONNECTION;
 }
+
+