This repository was archived by the owner on Nov 15, 2017. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork34
G.O.D - Grand Object-bound Dispatcher
License
NotificationsYou must be signed in to change notification settings
zeliard/Dispatcher
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
G.O.D is a high performance non-blocking task dispatcher which guarantees class member functions' execution sequence
- Designed for multi-platform by using C++11 standard
- Visual Studio Solutions for now, but you can easily use in *NIX environment (Just #include relevant files)
- Lock-free algorithms (non-blocking)
- Using custom STL allocator
- Deferred task execution using Timer
- Simple code-base for easy to understand (easy to adapt to other projects)
- TERA's Lock-Free Executor and Timer
- Conceptually the same, but G.O.D is a improved version of TERA's.
- Mac OS X Grand Central Dispatch (GCD)
- G.O.D is a kind of minimal/portable version of GCD
- base_version: basic version for educational purposes
- bind_version: std::bind is adopted instead of a custom Job class interface
- LB_version: load-balancing among worker-threads (new arrival!)
// First, you can attach G.O.D (AsyncExecutable) to an object like this:classTestObject :publicAsyncExecutable{public:voidTestFunc(double a,int b){// do something...// (e.g.) someobj->DoAsync(...);}// ... ...};// somewhere ...auto testobj = std::make_shared<TestObject>();///< new TestObject;// And then, make your own worker thread which implements Runnable::Run() like this:classTestWorkerThread :publicRunnable{public:virtualboolRun(){// Now, you can call a member function like this: testobj->DoAsync(&TestObject::TestFunc,100.123,456);// or, deferred execution 1000ms later like this: testobj->DoAsyncAfter(1000, &TestObject::TestFunc,100.123,456);// ... ...}};// Lastly, run worker-threads at the main() functionJobDispatcher<TestWorkerThread>workerService(WORKER_COUNT);workerService.RunWorkerThreads();
For more information, just see self-explaningDispatcherTest.cpp
- You should use x64 mode due to std::atomic variable alignment
- You should guarantee the lifetime (i.e. AsyncExecutable::mRefCount > 0) of an object inherited from AsyncExecutable
- Be careful to use DoAsync(...) in a blockable LOCK (critical section). It can cause deadlock...
About
G.O.D - Grand Object-bound Dispatcher
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.