------------------------------------------------------------------------------------------------
| 405 | |
| 406 | // ------------------------------------------------------------------------------------------------ |
| 407 | ASSIMP_API aiReturn aiDetachLogStream(const aiLogStream *stream) { |
| 408 | ASSIMP_BEGIN_EXCEPTION_REGION(); |
| 409 | |
| 410 | #ifndef ASSIMP_BUILD_SINGLETHREADED |
| 411 | std::lock_guard<std::mutex> lock(gLogStreamMutex); |
| 412 | #endif |
| 413 | // find the log-stream associated with this data |
| 414 | LogStreamMap::iterator it = gActiveLogStreams.find(*stream); |
| 415 | // it should be there... else the user is playing fools with us |
| 416 | if (it == gActiveLogStreams.end()) { |
| 417 | return AI_FAILURE; |
| 418 | } |
| 419 | DefaultLogger::get()->detachStream(it->second); |
| 420 | delete it->second; |
| 421 | |
| 422 | if ((Assimp::LogStream *)stream->user == DefaultStream) { |
| 423 | DefaultStream = nullptr; |
| 424 | } |
| 425 | |
| 426 | gActiveLogStreams.erase(it); |
| 427 | |
| 428 | if (gActiveLogStreams.empty()) { |
| 429 | DefaultLogger::kill(); |
| 430 | } |
| 431 | ASSIMP_END_EXCEPTION_REGION(aiReturn); |
| 432 | return AI_SUCCESS; |
| 433 | } |
| 434 | |
| 435 | // ------------------------------------------------------------------------------------------------ |
| 436 | ASSIMP_API void aiDetachAllLogStreams(void) { |
no test coverage detected