diff --git a/src/Draw/Draw_Interpretor.cxx b/src/Draw/Draw_Interpretor.cxx index 411fbf45ed..a5177e8de9 100644 --- a/src/Draw/Draw_Interpretor.cxx +++ b/src/Draw/Draw_Interpretor.cxx @@ -270,10 +270,7 @@ void Draw_Interpretor::add (const Standard_CString theCommandName, Draw_Interpretor::CallBackData* theCallback, const Standard_CString theGroup) { - if (myInterp == NULL) - { - Init(); - } + Standard_ASSERT_RAISE (myInterp != NULL, "Attempt to add command to Null interpretor"); Standard_PCharacter aName = (Standard_PCharacter )theCommandName; Standard_PCharacter aHelp = (Standard_PCharacter )theHelp; diff --git a/src/Draw/Draw_Window.cxx b/src/Draw/Draw_Window.cxx index 2ffd7eeafd..41f779650f 100644 --- a/src/Draw/Draw_Window.cxx +++ b/src/Draw/Draw_Window.cxx @@ -32,7 +32,6 @@ extern Standard_Boolean Draw_Batch; extern Standard_Boolean Draw_VirtualWindows; -static Tcl_Interp *interp; /* Interpreter for this application. */ static NCollection_List MyCallbacks; void Draw_Window::AddCallbackBeforeTerminate(FCallbackBeforeTerminate theCB) @@ -1110,9 +1109,9 @@ Standard_Boolean Init_Appli() { Draw_Interpretor& aCommands = Draw::GetInterpretor(); aCommands.Init(); - interp = aCommands.Interp(); + Tcl_Interp *interp = aCommands.Interp(); + Tcl_Init (interp); - Tcl_Init(interp) ; try { OCC_CATCH_SIGNALS Tk_Init(interp) ; @@ -1302,7 +1301,7 @@ static void StdinProc(ClientData clientData, int ) */ prompt: - if (tty) Prompt(interp, gotPartial); + if (tty) Prompt(Draw::GetInterpretor().Interp(), gotPartial); } catch (Standard_Failure) {} @@ -2031,14 +2030,9 @@ bool volatile isTkLoopStarted = false; Standard_Boolean Init_Appli(HINSTANCE hInst, HINSTANCE hPrevInst, int nShow, HWND& hWndFrame ) { - Draw_Interpretor& aCommands = Draw::GetInterpretor(); - DWORD IDThread; HANDLE hThread; console_semaphore = STOP_CONSOLE; - aCommands.Init(); - interp = aCommands.Interp(); - Tcl_Init(interp) ; dwMainThreadId = GetCurrentThreadId(); @@ -2050,14 +2044,18 @@ Standard_Boolean Init_Appli(HINSTANCE hInst, 0, // use default creation flags &IDThread); if (!hThread) { - cout << "Tcl/Tk main loop thread not created. Switching to batch mode..." << endl; + cout << "Failed to create Tcl/Tk main loop thread. Switching to batch mode..." << endl; Draw_Batch = Standard_True; + Draw_Interpretor& aCommands = Draw::GetInterpretor(); + aCommands.Init(); + Tcl_Interp *interp = aCommands.Interp(); + Tcl_Init(interp); #ifdef _TK try { OCC_CATCH_SIGNALS - Tk_Init(interp) ; - } catch (Standard_Failure) { - cout <<" Pb au lancement de TK_Init "< 0 } { + puts "Queue: [array names jobs]" + + foreach job [tpool::wait $worker [array names jobs]] { + puts -nonewline "Completed $job: " + puts "[tpool::get $worker $job]" + unset jobs($job) + } +} + +puts "Releasing worker" +tpool::release $worker + +catch {cpulimit 0} + +puts "TEST COMPLETED"