# HG changeset patch # User greg # Date 1242626321 -7200 # Node ID a3520d75a722774dc42f6fd51ca95dfef4531e03 # Parent 25b7b7f854bc4bac9aa898fe8b17ce53af54a3d0 get the WaitPythonCommands return (semaphore error code) to quit python_iterator loop when semaphore is destroyed diff -r 25b7b7f854bc -r a3520d75a722 targets/Xenomai/plc_Xenomai_main.c --- a/targets/Xenomai/plc_Xenomai_main.c Mon May 18 07:47:24 2009 +0200 +++ b/targets/Xenomai/plc_Xenomai_main.c Mon May 18 07:58:41 2009 +0200 @@ -208,10 +208,14 @@ int WaitDebugData() { char message; + int res; /* Wait signal from PLC thread */ - if (PLC_state & PLC_STATE_DEBUG_FILE_OPENED) - read(WaitDebug_pipe_fd, &message, sizeof(char)); - return __debug_tick; + if (PLC_state & PLC_STATE_DEBUG_FILE_OPENED) { + res = read(WaitDebug_pipe_fd, &message, sizeof(char)); + if (res == sizeof(char)) + return __debug_tick; + } + return -1; } /* Called by PLC thread when debug_publish finished @@ -252,8 +256,9 @@ /* Wait signal from PLC thread */ if (PLC_state & PLC_STATE_PYTHON_WAIT_SEM_CREATED) { rt_task_shadow(&WaitPythonCommand_task, "WaitPythonCommand_task", 0, 0); - rt_sem_p(&python_wait_sem, TM_INFINITE); - } + return rt_sem_p(&python_wait_sem, TM_INFINITE); + } + return -1; } /* Called by PLC thread on each new python command*/