blob: 5c8a908d8e38c73690cf54b4c9c41b5440a5af3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
#ifndef __TASKARGS_TASKARGS_H
#define __TASKARGS_TASKARGS_H
/**
* @file taskargs.H
*
* common file to hold arguments passed onto tasks.
*
* will also hold macros, etc to manage arguments
*/
#include <assert.h>
#include <sys/sync.h>
#include <trace/interface.H>
namespace INITSERVICE
{
/**
* @const TASKARGS_UNDEFINED64
* iv_taskreturncode and iv_taskcommand are initialized to this value -
* if parent or child change them, it can be easily recognized
*
*
*/
const uint64_t TASKARGS_UNDEFINED64 = 0xbadc0ffee0ddf00d;
/**
* @class TaskArgs
*
* passed into a task as a void* pointer
* contains:
* - barrier to wait on
* - data from parent (if used)
* - return code from child (if used)
* - pointer to errorlog handle
*
*/
class TaskArgs
{
public:
/**
* @brief TaskArgs constructor
*
*/
TaskArgs();
/**
* @brief TaskArgs destructor
*/
~TaskArgs();
/**
* @brief waitParentSync()
*
* Wait for internal barrier associated with this args struct
* This should be called by the task that launches a child task.
* Currently there is no difference between parent and child
* but this may change.
*
*/
void waitParentSync();
/**
* @brief waitChildSync()
*
* Wait for internal barrier associated with this args struct
* This should be called by the child task.
* Currently there is no difference between parent and child
* but this may change.
*
*/
void waitChildSync();
/**
* @brief postReturnCode
*
* Child task can use this to post a return code to InitServices
*
* @param[in] i_returncode;
*
*/
void postReturnCode( const uint64_t &i_returncode );
/**
* @brief getReturnCode
*
* Parent task can use this to get a return code from the child
*
* @return value of iv_taskreturncode;
*
*/
uint64_t getReturnCode( ) const;
/**
* @brief setCommand
*
* Parent can pass commands and info to the child using this function
*
* @param[in] i_command;
*/
void setCommand( const uint64_t &i_command );
/**
* @brief getCommand
*
* Child can get commands from the parent using this function
*
*@return value of iv_taskcommand;
*
* @todo might overload this later if we need to pass structs,
* buffers, etc.
*/
uint64_t getCommand( ) const;
private:
/**
* @note Disable copy constructor and assignment operator
*/
TaskArgs(const TaskArgs& i_right);
TaskArgs& operator=(const TaskArgs& i_right);
barrier_t iv_sync_barrier;
uint64_t iv_taskreturncode;
uint64_t iv_taskcommand;
};
}; // namespace TASKARGS
#endif
|