Commit Graph

14 Commits

Author SHA1 Message Date
John Firebaugh
fc64e97bce Simplify RunLoop
Instead of transforming between return value and callback, pass
the wrapped callback on to the invoked function as the last argument.

This eliminates the need for multiple invokeWithArgument overloads
and permits invoked functions to be asynchronous.
2015-07-01 16:12:12 -07:00
Thiago Marcos P. Santos
d30fce5f7d Catch exceptions when parsing tile PBFs
Also improved the error message and updated the test case.
2015-07-01 15:21:10 -07:00
John Firebaugh
eee02425fa Single-purpose Worker functions 2015-07-01 15:21:10 -07:00
John Firebaugh
5fadda53e5 Move WorkerTask functionality into RunLoop core
As a byproduct, this makes FileCache get requests properly
cancelable.
2015-07-01 15:21:10 -07:00
Thiago Marcos P. Santos
be4cb6786b Make the FileSource available from the ThreadContext
For now we set the FileSource for the Worker context
but in the future after fixing #1664 we can assert()
that FileSource are set only for the Map thread context.
2015-06-25 16:26:21 +03:00
Thiago Marcos P. Santos
a8b6b67dfe Introduce the ThreadContext
mbgl::Thread will keep a ThreadContext for each running instance
in a thread_local so we don't need to lookup a man in the Environment
every time we need some info about the current thread.

This patch is moving the ::currentlyOn check used on Debug build from
the Environment class to the ThreadContext.
2015-06-25 16:26:21 +03:00
Konstantin Käfer
f4707f72e0 Replace mbgl::util::make_unique<> with std::make_unique<> 2015-05-26 17:57:38 +02:00
Konstantin Käfer
8ee40a544e make WorkRequests cancelable 2015-05-08 16:43:18 +02:00
John Firebaugh
5b4015ccba Reference safety for Worker after callbacks
Joining a WorkRequest now ensures that either the after callback has
already been executed, or will never be executed.

Fixes #1438
2015-05-06 14:30:02 -07:00
John Firebaugh
5c7867f435 Join worker tasks before destroying TileData
Fixes #1309
2015-05-04 15:09:19 -07:00
Konstantin Käfer
27d8e82e1c lower thread priority of worker threads 2015-05-04 17:33:05 +02:00
John Firebaugh
24695f6c02 More bandaids to avoid #1309
Even though we only bind the shared_ptr in the after callback, the
worker thread was still copying the callback and therefore gaining
a shared reference. Here we try to eliminate the copies.
2015-05-01 17:14:06 -04:00
John Firebaugh
4ccf246c10 Rewrite Worker in terms of Thread<> 2015-04-28 14:32:26 -04:00
John Firebaugh
0c087603e6 Replace uv_messenger with AsyncQueue; rewrite remaining uv_* in C++ 2015-04-09 15:30:58 -07:00