In async mode, worker thread can now execute an optional teardown callback upon exit.

(Note: this can be helpful when a custom sink invokes a JNI callback, which implies that worker thread was previously attached to JVM, and needs to be cleanly detached upon exit)
This commit is contained in:
Philippe Serreault
2016-05-11 17:22:09 +02:00
parent 409f24d104
commit ee815042dd
6 changed files with 35 additions and 19 deletions

View File

@@ -53,7 +53,10 @@ void set_level(level::level_enum log_level);
// worker_warmup_cb (optional):
// callback function that will be called in worker thread upon start (can be used to init stuff like thread affinity)
//
void set_async_mode(size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function<void()>& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero());
// worker_teardown_cb (optional):
// callback function that will be called in worker thread upon exit
//
void set_async_mode(size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function<void()>& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function<void()>& worker_teardown_cb = nullptr);
// Turn off async mode
void set_sync_mode();