* 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.
return openocd_main(argc, argv);
}
+
return ERROR_OK;
}
-void lockBigLock();
-void unlockBigLock();
Jim_Interp *interp;
command_context_t *active_cmd_ctx;
int retval;
char *cmd = (char*)Jim_GetString(argv[1], NULL);
- lockBigLock();
-
Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
if (startLoop)
log_remove_callback(tcl_output, tclOutput);
Jim_SetResult(interp, tclOutput);
- unlockBigLock();
return (ignore||(retval==ERROR_OK))?JIM_OK:JIM_ERR;
}
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)
{
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;
#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)
{
}
#endif
}
- if (--lockCount==0)
- {
- unlockBigLock();
- }
return ERROR_OK;
}
signal(SIGBREAK, sig_handler);
signal(SIGABRT, sig_handler);
#endif
+
return ERROR_OK;
}
return ERROR_COMMAND_CLOSE_CONNECTION;
}
+
+