MCPcopy Create free account
hub / github.com/SoarGroup/Soar / Stop

Method Stop

Core/ConnectionSML/src/thread_Thread.cpp:62–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void Thread::Stop(bool waitTillStopped)
63{
64 // We also just signal the thread and ask it to stop.
65 // We don't currently offer a "force thread to stop" method as that's
66 // generally not a very safe thing to do. If you feel you need it, add a "ForceStop" method.
67 m_QuitNow = true ;
68
69 // If the thread was never started or is already stopped we're done.
70 if (!m_Started || IsStopped())
71 {
72 return ;
73 }
74
75 int maxTries = 1000 ;
76
77 // If we've been asked to wait for the thread to quit then pause for a moment while it terminates.
78 while (waitTillStopped && !IsStopped() && maxTries > 0)
79 {
80 sml::Sleep(0, 10) ;
81 maxTries-- ;
82 }
83
84 if (maxTries <= 0)
85 {
86 sml::PrintDebug("Timed out waiting for thread to stop") ;
87 }
88}
89

Callers 4

StopReceiverThreadMethod · 0.80
ShutdownMethod · 0.80
~KernelMethod · 0.80
StopEventThreadMethod · 0.80

Calls 1

IsStoppedFunction · 0.70

Tested by

no test coverage detected