feat: enhance math and tensor modules with new functionalities and documentation updates
- Updated the math module to include vector and matrix operations, noise generation, Bezier curves, and random number utilities. - Introduced the tensor module, providing TensorFlow 2-style eager execution and graph building capabilities. - Enhanced documentation to reflect the new features in the math and tensor modules, including usage examples and API references. - Modified CMakeLists.txt to include the new math and tensor modules, ensuring proper build configurations. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
87145e5ce2
commit
d1034c4c2b
84 files changed
+10296
-270
No files matched your search
@@ -1,6 +1,8 @@
|
||||
#include "thread/ThreadPool.h"
|
||||
|
||||
#include "common/Exception.h"
|
||||
#include "common/Module.h"
|
||||
#include "event/Event.h"
|
||||
#include "thread/Channel.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -73,6 +75,21 @@ Task *ThreadPool::submitPush(Channel *channel, std::string message, int delayMs)
|
||||
});
|
||||
}
|
||||
|
||||
Task *ThreadPool::submitPost(std::string name, std::string data, int delayMs) {
|
||||
if (name.empty())
|
||||
throw eve::Exception("ThreadPool::submitPost: name must not be empty");
|
||||
if (delayMs < 0)
|
||||
delayMs = 0;
|
||||
return submit([name = std::move(name), data = std::move(data), delayMs] {
|
||||
if (delayMs > 0)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(delayMs));
|
||||
auto *ev = ModuleManager::getInstance<event::Event>("Event");
|
||||
if (!ev)
|
||||
ev = event::Event::create();
|
||||
ev->pushData(name, data);
|
||||
});
|
||||
}
|
||||
|
||||
void ThreadPool::waitAll() {
|
||||
std::unique_lock<std::mutex> lock(mu_);
|
||||
idleCv_.wait(lock, [this] { return queue_.empty() && busy_ == 0; });
|
||||
|
||||
Reference in new issue
Block a user