comparison FXAnalyse.c @ 105:29b1aa89a34c

Disable the Start button when data acquisition thread is running This avoids the race condition encountered when data acquisition is re-started while waiting for the previous data acquisition thread to terminate.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 08 Apr 2013 18:08:37 +0200
parents 675cb8d5e8a7
children 2a9f8a811d87
comparison
equal deleted inserted replaced
104:ad40873feca1 105:29b1aa89a34c
523 case EVENT_COMMIT: 523 case EVENT_COMMIT:
524 if (acquiring) 524 if (acquiring)
525 break; 525 break;
526 526
527 logmsg("Start"); 527 logmsg("Start");
528 SetCtrlAttribute(panel, PANEL_STARTBUTTON, ATTR_DIMMED, TRUE);
528 acquiring = 1; 529 acquiring = 1;
529 530
530 // start data provider thread 531 // start data provider thread
531 CmtScheduleThreadPoolFunctionAdv( 532 CmtScheduleThreadPoolFunctionAdv(
532 DEFAULT_THREAD_POOL_HANDLE, DataProvider, NULL, 533 DEFAULT_THREAD_POOL_HANDLE, DataProvider, NULL,
552 CmtWaitForThreadPoolFunctionCompletion( 553 CmtWaitForThreadPoolFunctionCompletion(
553 DEFAULT_THREAD_POOL_HANDLE, dataProviderThread, 554 DEFAULT_THREAD_POOL_HANDLE, dataProviderThread,
554 OPT_TP_PROCESS_EVENTS_WHILE_WAITING); 555 OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
555 CmtReleaseThreadPoolFunctionID( 556 CmtReleaseThreadPoolFunctionID(
556 DEFAULT_THREAD_POOL_HANDLE, dataProviderThread); 557 DEFAULT_THREAD_POOL_HANDLE, dataProviderThread);
558
559 SetCtrlAttribute(panel, PANEL_STARTBUTTON, ATTR_DIMMED, FALSE);
557 560
558 break; 561 break;
559 } 562 }
560 return 0; 563 return 0;
561 } 564 }