|
|
| 30 |
#include "ns3/global-value.h" |
30 |
#include "ns3/global-value.h" |
| 31 |
#include "ns3/assert.h" |
31 |
#include "ns3/assert.h" |
| 32 |
#include "ns3/log.h" |
32 |
#include "ns3/log.h" |
|
|
33 |
#include "ns3/fatal-impl.h" |
| 33 |
|
34 |
|
| 34 |
#include <math.h> |
35 |
#include <math.h> |
| 35 |
#include <fstream> |
36 |
#include <fstream> |
|
|
| 51 |
TypeIdValue (MapScheduler::GetTypeId ()), |
52 |
TypeIdValue (MapScheduler::GetTypeId ()), |
| 52 |
MakeTypeIdChecker ()); |
53 |
MakeTypeIdChecker ()); |
| 53 |
|
54 |
|
|
|
55 |
struct sigaction Simulator::m_act; |
| 56 |
|
| 54 |
static void |
57 |
static void |
| 55 |
TimePrinter (std::ostream &os) |
58 |
TimePrinter (std::ostream &os) |
| 56 |
{ |
59 |
{ |
|
|
| 160 |
Simulator::Run (void) |
163 |
Simulator::Run (void) |
| 161 |
{ |
164 |
{ |
| 162 |
NS_LOG_FUNCTION_NOARGS (); |
165 |
NS_LOG_FUNCTION_NOARGS (); |
|
|
166 |
OverrideInterruptHandler (); |
| 163 |
GetImpl ()->Run (); |
167 |
GetImpl ()->Run (); |
| 164 |
} |
168 |
} |
| 165 |
|
169 |
|
|
|
| 167 |
Simulator::RunOneEvent (void) |
171 |
Simulator::RunOneEvent (void) |
| 168 |
{ |
172 |
{ |
| 169 |
NS_LOG_FUNCTION_NOARGS (); |
173 |
NS_LOG_FUNCTION_NOARGS (); |
|
|
174 |
OverrideInterruptHandler (); |
| 170 |
GetImpl ()->RunOneEvent (); |
175 |
GetImpl ()->RunOneEvent (); |
| 171 |
} |
176 |
} |
| 172 |
|
177 |
|
|
|
| 366 |
return GetImpl (); |
371 |
return GetImpl (); |
| 367 |
} |
372 |
} |
| 368 |
|
373 |
|
|
|
374 |
void |
| 375 |
Simulator::OverrideInterruptHandler (void) |
| 376 |
{ |
| 377 |
// override default SIGABRT handler |
| 378 |
struct sigaction act; |
| 379 |
act.sa_flags = 0; |
| 380 |
sigemptyset (&act.sa_mask); |
| 381 |
act.sa_handler = InterruptHandler; |
| 382 |
sigaction (SIGINT, &act, &m_act); |
| 383 |
} |
| 369 |
|
384 |
|
|
|
385 |
void |
| 386 |
Simulator::InterruptHandler (int sig_num) |
| 387 |
{ |
| 388 |
FatalImpl::FlushStreams (); |
| 389 |
// restore previous handler |
| 390 |
sigaction (SIGINT, &m_act, 0); |
| 391 |
// resend signal |
| 392 |
raise (SIGINT); |
| 393 |
} |
| 370 |
|
394 |
|
| 371 |
} // namespace ns3 |
395 |
} // namespace ns3 |
| 372 |
|
396 |
|