ns-3 Direct Code Execution
Home
Tutorials ▼
Docs ▼
Wiki
Manual
Develop ▼
API
Bugs
API
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
waiter.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#ifndef WAITER_H
21
#define WAITER_H
22
23
#include "ns3/nstime.h"
24
#include "ns3/callback.h"
25
#include "ns3/event-id.h"
26
27
namespace
ns3 {
28
29
struct
Thread;
30
31
class
Waiter
32
{
33
public
:
34
typedef
enum
35
{
36
INTERRUPTED
,
37
TIMEOUT
,
38
OK
39
}
Result
;
40
41
Waiter
();
42
~Waiter
();
43
44
void
SetTimeout
(Time timeout);
45
Time
GetTimeoutLeft
(
void
)
const
;
46
// wait for a call to Wakeup, return OK if Wakeup is called
47
// and no signal is pending.
48
// return TIMEOUT if timeout expired
49
// return INTERRUPTED if signal pending.
50
Waiter::Result
Wait
(
void
);
51
// wait for a call to Wakeup, handle signals and stop timeout
52
// if any are pending. Return true only if Wakeup is called
53
// and no signal is pending.
54
bool
WaitDoSignal
(
void
);
55
56
// wakeup someone waiting on Wait.
57
void
Wakeup
(
void
);
58
private
:
59
Thread
*
m_waiting
;
60
Time
m_timeout
;
61
};
62
63
}
// namespace ns3
64
65
#endif
/* WAITER_H */
model
waiter.h
Generated on Fri Aug 30 2013 13:57:56 for ns-3-dce by
1.8.1.2