#include <fiber-manager.h>
Public Member Functions | |
virtual | ~FiberManager () |
virtual struct Fiber * | Clone (struct Fiber *fiber) |
virtual struct Fiber * | Create (void(*callback)(void *), void *context, uint32_t stackSize)=0 |
virtual struct Fiber * | CreateFromCaller (void)=0 |
virtual void | Delete (struct Fiber *fiber)=0 |
virtual uint32_t | GetStackSize (struct Fiber *fiber) const =0 |
virtual void | SetSwitchNotification (void(*fn)(void))=0 |
virtual void | SwitchTo (struct Fiber *from, const struct Fiber *to)=0 |
Definition at line 11 of file fiber-manager.h.
|
virtual |
Definition at line 5 of file fiber-manager.cc.
Reimplemented in ns3::PthreadFiberManager.
Definition at line 16 of file fiber-manager.h.
Referenced by ns3::TaskManager::Clone().
|
readpure virtual |
callback | function to use as main loop for the newly-created fiber |
stackSize | size of the stack to allocate for this fiber. |
Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.
Referenced by ns3::TaskManager::Start().
|
readpure virtual |
Create a fiber context which can be used as a from argument to the SwitchTo method This method is usually used to create a context which references the main 'normal' thread. i.e., the thread initially managed by the underlying kernel which runs on the kernel-managed stack.
Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.
Referenced by ns3::TaskManager::SetFiberManagerType().
|
pure virtual |
context | to delete |
Release any ressource associated to this context. Obviously, this method must be called from another context than the one which is being deleted.
Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.
Referenced by ns3::TaskManager::GarbageCollectDeadTasks(), ns3::TaskManager::Stop(), and ns3::TaskManager::~TaskManager().
|
pure virtual |
Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.
Referenced by ns3::TaskManager::GetStackSize().
|
pure virtual |
fn | a function which will be invoked whenever SwitchTo is invoked, just before it returns to the destination fiber. |
Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.
Referenced by ns3::TaskManager::SetFiberManagerType(), and ns3::TaskManager::SetSwitchNotify().
|
pure virtual |
from | from context |
to | to context |
This function saves the caller's context into the from context and restores the current context from the to context. The first time this function is called, it is usually called with a from set to a context obtained through CreateFromCaller and with a to set to a context obtained through Create.
Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.
Referenced by ns3::TaskManager::ExecOnMain(), and ns3::TaskManager::Schedule().