missplaced Lock fixed 39/16939/3
Cedric Delamarre [Thu, 30 Jul 2015 14:43:33 +0000 (16:43 +0200)]
get the test case of bug 12722, then click in the window and press some keys.

Change-Id: I0833d68f1effe1cb2bb0a461f7113b953d54e3d4

scilab/modules/core/src/cpp/runner.cpp

index 48c2964..95b939c 100644 (file)
@@ -113,9 +113,6 @@ void Runner::execAndWait(ast::Exp* _theProgram, ast::ExecVisitor *_visitor,
         __threadKey threadKey;
         __threadId threadId;
 
-        //lock locker
-        ThreadManagement::LockRunner();
-
         types::ThreadId* pInterruptibleThread = ConfigVariable::getLastRunningThread();
         if (_isPrioritaryThread)
         {
@@ -139,6 +136,11 @@ void Runner::execAndWait(ast::Exp* _theProgram, ast::ExecVisitor *_visitor,
             pInterruptibleThread = NULL;
         }
 
+        // Lock the thread "Runner::launch" to be sure that all
+        // stuff performed before the "WaitForAwakeRunnerSignal"
+        // are done.
+        ThreadManagement::LockRunner();
+
         //launch thread but is can't really start since locker is locked
         __CreateThreadWithParams(&threadId, &threadKey, &Runner::launch, runMe);
         runMe->setThreadId(threadId);