A Discrete-Event Network Simulator
API
main-test-sync.cc File Reference

An example of scheduling events in a background thread. More...

#include "ns3/simulator.h"
#include "ns3/realtime-simulator-impl.h"
#include "ns3/nstime.h"
#include "ns3/log.h"
#include "ns3/system-thread.h"
#include "ns3/string.h"
#include "ns3/config.h"
#include "ns3/global-value.h"
#include "ns3/ptr.h"
#include <unistd.h>
#include <sys/time.h>
+ Include dependency graph for main-test-sync.cc:

Go to the source code of this file.

Classes

class  FakeNetDevice
 Example class with a method for the background task. More...
 

Functions

void background_function (void)
 An event method called many times from the main thread. More...
 
void first_function (void)
 An event method called once from the main thread. More...
 
void inserted_function (void)
 An event method called many times from the background thread. More...
 
void test (void)
 Example use of ns3::SystemThread. More...
 

Variables

bool gFirstRun = false
 Check that the event functions run in the intended order. More...
 

Detailed Description

An example of scheduling events in a background thread.

See ns3::SystemThread, ns3::SimulatorImpl::ScheduleWithContext

Definition in file main-test-sync.cc.

Function Documentation

void background_function ( void  )

An event method called many times from the main thread.

Definition at line 59 of file main-test-sync.cc.

References gFirstRun, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_UNCOND.

Referenced by test().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void first_function ( void  )

An event method called once from the main thread.

Definition at line 68 of file main-test-sync.cc.

References gFirstRun, ns3::Simulator::Now(), and NS_LOG_UNCOND.

Referenced by test().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void inserted_function ( void  )

An event method called many times from the background thread.

Definition at line 50 of file main-test-sync.cc.

References gFirstRun, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_UNCOND.

Referenced by FakeNetDevice::Doit3().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool gFirstRun = false

Check that the event functions run in the intended order.

Definition at line 46 of file main-test-sync.cc.

Referenced by background_function(), first_function(), and inserted_function().