From 3696e051935648c38a003291bd1e6bea202a2e3d Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Sun, 9 Nov 2014 22:54:05 +1100 Subject: Add async asserts --- src/map/map.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/map/map.cpp b/src/map/map.cpp index ed105375fb..2de77cd3c7 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -78,7 +78,7 @@ uv::worker &Map::getWorker() { return *workers; } -void Map::start() { // TODO add pause arg +void Map::start(bool start_paused) { assert(uv_thread_self() == main_thread); assert(!async); @@ -89,6 +89,11 @@ void Map::start() { // TODO add pause arg // Reset the flag. is_stopped = false; + // Do we need to pause first? + if (start_paused) { + pause(); + } + // Setup async notifications // Iron out the differences between libuv 0.10 and 0.11 @@ -159,8 +164,9 @@ void Map::stop(stop_callback cb, void *data) { async = false; } -void Map::pause() { +void Map::pause(bool wait_for_pause) { assert(uv_thread_self() == main_thread); + assert(async); Log::Info(Event::General, "Map::pause() start"); // TODO wait until paused before return @@ -182,6 +188,7 @@ void Map::pause() { void Map::resume() { assert(uv_thread_self() == main_thread); + assert(async); Log::Info(Event::General, "Map::resume() start"); Log::Info(Event::General, "Map::resume() locking"); -- cgit v1.2.1