diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/storage/asset_file_source.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/storage/local_file_source.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/util/thread.hpp (renamed from src/mbgl/util/threaded_object.hpp) | 14 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/mbgl/storage/asset_file_source.hpp b/src/mbgl/storage/asset_file_source.hpp index 54b8ba56f7..6ed7af8aaf 100644 --- a/src/mbgl/storage/asset_file_source.hpp +++ b/src/mbgl/storage/asset_file_source.hpp @@ -5,7 +5,7 @@ namespace mbgl { namespace util { -template <typename T> class ThreadedObject; +template <typename T> class Thread; } // namespace util class AssetFileSource : public FileSource { @@ -18,7 +18,7 @@ public: private: class Impl; - std::unique_ptr<util::ThreadedObject<Impl>> impl; + std::unique_ptr<util::Thread<Impl>> impl; }; } // namespace mbgl diff --git a/src/mbgl/storage/local_file_source.hpp b/src/mbgl/storage/local_file_source.hpp index 1e785379c0..0f065e0b5f 100644 --- a/src/mbgl/storage/local_file_source.hpp +++ b/src/mbgl/storage/local_file_source.hpp @@ -5,7 +5,7 @@ namespace mbgl { namespace util { -template <typename T> class ThreadedObject; +template <typename T> class Thread; } // namespace util class LocalFileSource : public FileSource { @@ -20,7 +20,7 @@ public: private: class Impl; - std::unique_ptr<util::ThreadedObject<Impl>> impl; + std::unique_ptr<util::Thread<Impl>> impl; }; } // namespace mbgl diff --git a/src/mbgl/util/threaded_object.hpp b/src/mbgl/util/thread.hpp index 7310eed2b1..572f46080e 100644 --- a/src/mbgl/util/threaded_object.hpp +++ b/src/mbgl/util/thread.hpp @@ -22,8 +22,8 @@ namespace util { // Manages a thread with `Object`. // Upon creation of this object, it launches a thread and creates an object of type `Object` -// in that thread. When the `ThreadedObject<>` object is destructed, the destructor waits -// for thread termination. The `ThreadedObject<>` constructor blocks until the thread and +// in that thread. When the `Thread<>` object is destructed, the destructor waits +// for thread termination. The `Thread<>` constructor blocks until the thread and // the `Object` are fully created, so after the object creation, it's safe to obtain the // `Object` stored in this thread. The thread created will always have low priority on // the platforms that support setting thread priority. @@ -32,15 +32,15 @@ namespace util { // // - Only one thread is created. // - `Object` will live in a single thread, providing thread affinity. -// - It is safe to use `ThreadLocal` in an `Object` managed by `ThreadedObject<>` +// - It is safe to use `ThreadLocal` in an `Object` managed by `Thread<>` // - A `RunLoop` is created for the `Object` thread. // - `Object` can use `Timer` and do asynchronous I/O, like wait for sockets events. // template<class Object> -class ThreadedObject : public Scheduler { +class Thread : public Scheduler { public: template <class... Args> - ThreadedObject(const std::string& name, Args&&... args) { + Thread(const std::string& name, Args&&... args) { std::promise<void> running; thread = std::thread([&] { @@ -60,7 +60,7 @@ public: running.get_future().get(); } - ~ThreadedObject() override { + ~Thread() override { MBGL_VERIFY_THREAD(tid); if (paused) { @@ -86,7 +86,7 @@ public: // Returns a non-owning reference to `Object` that // can be used to send messages to `Object`. It is safe // to the non-owning reference to outlive this object - // and be used after the `ThreadedObject<>` gets destroyed. + // and be used after the `Thread<>` gets destroyed. ActorRef<std::decay_t<Object>> actor() const { return object->self(); } |