MCPcopy Create free account
hub / github.com/anjo76/angelscript / Unprepare

Method Unprepare

sdk/angelscript/source/as_thread.cpp:176–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void asCThreadManager::Unprepare()
177{
178 asASSERT(threadManager);
179
180 if( threadManager == 0 )
181 return;
182
183 // It's necessary to protect this section so no
184 // other thread attempts to call AddRef or Release
185 // while clean up is in progress.
186 ENTERCRITICALSECTION(threadManager->criticalSection);
187 if( --threadManager->refCount == 0 )
188 {
189 // Make sure the local data is destroyed, at least for the current thread
190 CleanupLocalData();
191
192 // As the critical section will be destroyed together
193 // with the thread manager we must first clear the global
194 // variable in case a new thread manager needs to be created;
195 asCThreadManager *mgr = threadManager;
196 threadManager = 0;
197
198 // Leave the critical section before it is destroyed
199 LEAVECRITICALSECTION(mgr->criticalSection);
200
201 asDELETE(mgr,asCThreadManager);
202 }
203 else
204 LEAVECRITICALSECTION(threadManager->criticalSection);
205}
206
207asCThreadManager::~asCThreadManager()
208{

Callers 4

ReturnContextToPoolMethod · 0.45
ReturnContextCallbackFunction · 0.45
test_exception.cppFile · 0.45
test_context.cppFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected