targets/Linux/plc_Linux_main.c
changeset 227 48c13b84505c
parent 205 ee8d1f4528ef
child 235 a66e150f2888
equal deleted inserted replaced
226:f301f4ed4717 227:48c13b84505c
    94     __cleanup();
    94     __cleanup();
    95 }
    95 }
    96 
    96 
    97 pthread_mutex_t DebugLock = PTHREAD_MUTEX_INITIALIZER;
    97 pthread_mutex_t DebugLock = PTHREAD_MUTEX_INITIALIZER;
    98 
    98 
       
    99 static int __debug_tick;
       
   100 extern int __tick;
    99 /* from plc_debugger.c */
   101 /* from plc_debugger.c */
   100 void WaitDebugData()
   102 int WaitDebugData()
   101 {
   103 {
   102     /* Wait signal from PLC thread */
   104     /* Wait signal from PLC thread */
   103     pthread_mutex_lock(&DebugLock);
   105     pthread_mutex_lock(&DebugLock);
       
   106     return __debug_tick;
   104 }
   107 }
   105  
   108  
   106 /* Called by PLC thread when debug_publish finished
   109 /* Called by PLC thread when debug_publish finished
   107  * This is supposed to unlock debugger thread in WaitDebugData*/
   110  * This is supposed to unlock debugger thread in WaitDebugData*/
   108 void InitiateDebugTransfer()
   111 void InitiateDebugTransfer()
   109 {
   112 {
   110     /* signal debugger thread to continue*/
   113     /* signal debugger thread to continue*/
       
   114     __debug_tick = __tick;
   111     pthread_mutex_unlock(&DebugLock);
   115     pthread_mutex_unlock(&DebugLock);
   112 }
   116 }