diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2015-01-15 15:52:23 -0800 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2015-01-15 15:52:23 -0800 |
commit | 60f825b5cc92bbfffe1f27f960b9f9d7d226547e (patch) | |
tree | 6ebaa0b4cfed8d527faea8a68eaafb41828742ab | |
parent | 503c657d31937606b00fc8dd049d78667ab4cee2 (diff) |
Retain dispatch queue when using dispatch_sync()
-rw-r--r-- | src/core/basetypes/MCObject.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/basetypes/MCObject.cpp b/src/core/basetypes/MCObject.cpp index 28fa3544..3034c791 100644 --- a/src/core/basetypes/MCObject.cpp +++ b/src/core/basetypes/MCObject.cpp @@ -310,9 +310,11 @@ void Object::performMethodOnMainThread(Method method, void * context, bool waitU void Object::performMethodOnDispatchQueue(Method method, void * context, void * targetDispatchQueue, bool waitUntilDone) { if (waitUntilDone) { + dispatch_retain((dispatch_queue_t) targetDispatchQueue); dispatch_sync((dispatch_queue_t) targetDispatchQueue, ^{ (this->*method)(context); }); + dispatch_release((dispatch_queue_t) targetDispatchQueue); } else { dispatch_async((dispatch_queue_t) targetDispatchQueue, ^{ |