-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add executor singleton and remove tbb
- Loading branch information
1 parent
5914b0b
commit cb061ac
Showing
8 changed files
with
45 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// This header should not be included by another header file, only by source files. | ||
#pragma once | ||
|
||
#include <mutex> | ||
#include <taskflow/taskflow.hpp> // includes <thread>, <mutex>, <memory> | ||
|
||
// Taskflow executor singleton wrapper (not thread-safe by design) | ||
namespace vlm { | ||
class Executor { | ||
public: | ||
Executor(const Executor&) = delete; | ||
Executor& operator=(const Executor&) = delete; | ||
static tf::Executor& instance(size_t num_threads) { | ||
if (!_instance) _instance = std::make_unique<tf::Executor>(num_threads ? num_threads : std::thread::hardware_concurrency()); | ||
return *_instance; | ||
} | ||
static tf::Executor& get() { | ||
if (!_instance) return instance(0); | ||
return *_instance; | ||
} | ||
private: | ||
static std::unique_ptr<tf::Executor> _instance; | ||
|
||
Executor() = default; | ||
~Executor() = default; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "vlm_executor.hpp" | ||
|
||
using namespace vlm; | ||
|
||
std::unique_ptr<tf::Executor> Executor::_instance = nullptr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters