ns-3 Direct Code Execution
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ns3::FiberManager Class Reference

#include <fiber-manager.h>

+ Inheritance diagram for ns3::FiberManager:

Public Member Functions

virtual ~FiberManager ()
virtual struct FiberClone (struct Fiber *fiber)
virtual struct FiberCreate (void(*callback)(void *), void *context, uint32_t stackSize)=0
virtual struct FiberCreateFromCaller (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

Detailed Description

Definition at line 11 of file fiber-manager.h.

Constructor & Destructor Documentation

ns3::FiberManager::~FiberManager ( )
virtual

Definition at line 5 of file fiber-manager.cc.

Member Function Documentation

virtual struct Fiber* ns3::FiberManager::Clone ( struct Fiber fiber)
inlinereadvirtual

Reimplemented in ns3::PthreadFiberManager.

Definition at line 16 of file fiber-manager.h.

Referenced by ns3::TaskManager::Clone().

+ Here is the caller graph for this function:

virtual struct Fiber* ns3::FiberManager::Create ( void(*)(void *)  callback,
void *  context,
uint32_t  stackSize 
)
readpure virtual
Parameters
callbackfunction to use as main loop for the newly-created fiber
stackSizesize of the stack to allocate for this fiber.
Returns
a newly-created fiber context.

Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.

Referenced by ns3::TaskManager::Start().

+ Here is the caller graph for this function:

virtual struct Fiber* ns3::FiberManager::CreateFromCaller ( void  )
readpure virtual
Returns
an empty context

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().

+ Here is the caller graph for this function:

virtual void ns3::FiberManager::Delete ( struct Fiber fiber)
pure virtual
Parameters
contextto 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().

+ Here is the caller graph for this function:

virtual uint32_t ns3::FiberManager::GetStackSize ( struct Fiber fiber) const
pure virtual
Returns
size of stack allocated in fiber.

Implemented in ns3::PthreadFiberManager, and ns3::UcontextFiberManager.

Referenced by ns3::TaskManager::GetStackSize().

+ Here is the caller graph for this function:

virtual void ns3::FiberManager::SetSwitchNotification ( void(*)(void)  fn)
pure virtual
Parameters
fna 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().

+ Here is the caller graph for this function:

virtual void ns3::FiberManager::SwitchTo ( struct Fiber from,
const struct Fiber to 
)
pure virtual
Parameters
fromfrom context
toto 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().

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files: