Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ae4813ec
authored
8 years ago
by
Marcus Winter
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'embb581_mtapi_task_wait_timing_fix' into development
parents
2c901ecd
5c73ee43
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
0 deletions
+56
-0
mtapi_c/src/embb_mtapi_action_t.c
+16
-0
mtapi_c/src/embb_mtapi_group_t.c
+16
-0
mtapi_c/src/embb_mtapi_queue_t.c
+16
-0
mtapi_c/src/embb_mtapi_scheduler_t.c
+8
-0
No files found.
mtapi_c/src/embb_mtapi_action_t.c
View file @
ae4813ec
...
@@ -289,10 +289,12 @@ void mtapi_action_delete(
...
@@ -289,10 +289,12 @@ void mtapi_action_delete(
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_duration_t
wait_duration
;
embb_duration_t
wait_duration
;
embb_time_t
start_time
;
embb_time_t
end_time
;
embb_time_t
end_time
;
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_duration_set_milliseconds
(
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_time_now
(
&
start_time
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
}
...
@@ -309,6 +311,12 @@ void mtapi_action_delete(
...
@@ -309,6 +311,12 @@ void mtapi_action_delete(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_time_t
current_time
;
embb_time_t
current_time
;
embb_time_now
(
&
current_time
);
embb_time_now
(
&
current_time
);
if
(
embb_time_compare
(
&
current_time
,
&
start_time
)
<
0
)
{
/* time has moved backwards, maybe a wraparound or jitter
move end_time backward to avoid endeless loop */
start_time
=
current_time
;
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
/* timeout! */
/* timeout! */
local_status
=
MTAPI_TIMEOUT
;
local_status
=
MTAPI_TIMEOUT
;
...
@@ -362,10 +370,12 @@ void mtapi_action_disable(
...
@@ -362,10 +370,12 @@ void mtapi_action_disable(
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_duration_t
wait_duration
;
embb_duration_t
wait_duration
;
embb_time_t
start_time
;
embb_time_t
end_time
;
embb_time_t
end_time
;
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_duration_set_milliseconds
(
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_time_now
(
&
start_time
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
}
...
@@ -382,6 +392,12 @@ void mtapi_action_disable(
...
@@ -382,6 +392,12 @@ void mtapi_action_disable(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_time_t
current_time
;
embb_time_t
current_time
;
embb_time_now
(
&
current_time
);
embb_time_now
(
&
current_time
);
if
(
embb_time_compare
(
&
current_time
,
&
start_time
)
<
0
)
{
/* time has moved backwards, maybe a wraparound or jitter
move end_time backward to avoid endeless loop */
start_time
=
current_time
;
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
/* timeout! */
/* timeout! */
local_status
=
MTAPI_TIMEOUT
;
local_status
=
MTAPI_TIMEOUT
;
...
...
This diff is collapsed.
Click to expand it.
mtapi_c/src/embb_mtapi_group_t.c
View file @
ae4813ec
...
@@ -213,10 +213,12 @@ void mtapi_group_wait_all(
...
@@ -213,10 +213,12 @@ void mtapi_group_wait_all(
node
->
group_pool
,
group
);
node
->
group_pool
,
group
);
embb_duration_t
wait_duration
;
embb_duration_t
wait_duration
;
embb_time_t
start_time
;
embb_time_t
end_time
;
embb_time_t
end_time
;
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_duration_set_milliseconds
(
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_time_now
(
&
start_time
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
}
...
@@ -232,6 +234,12 @@ void mtapi_group_wait_all(
...
@@ -232,6 +234,12 @@ void mtapi_group_wait_all(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_time_t
current_time
;
embb_time_t
current_time
;
embb_time_now
(
&
current_time
);
embb_time_now
(
&
current_time
);
if
(
embb_time_compare
(
&
current_time
,
&
start_time
)
<
0
)
{
/* time has moved backwards, maybe a wraparound or jitter
move end_time backward to avoid endeless loop */
start_time
=
current_time
;
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
/* timeout! */
/* timeout! */
local_status
=
MTAPI_TIMEOUT
;
local_status
=
MTAPI_TIMEOUT
;
...
@@ -300,10 +308,12 @@ void mtapi_group_wait_any(
...
@@ -300,10 +308,12 @@ void mtapi_group_wait_any(
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_duration_t
wait_duration
;
embb_duration_t
wait_duration
;
embb_time_t
start_time
;
embb_time_t
end_time
;
embb_time_t
end_time
;
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_duration_set_milliseconds
(
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_time_now
(
&
start_time
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
}
...
@@ -318,6 +328,12 @@ void mtapi_group_wait_any(
...
@@ -318,6 +328,12 @@ void mtapi_group_wait_any(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_time_t
current_time
;
embb_time_t
current_time
;
embb_time_now
(
&
current_time
);
embb_time_now
(
&
current_time
);
if
(
embb_time_compare
(
&
current_time
,
&
start_time
)
<
0
)
{
/* time has moved backwards, maybe a wraparound or jitter
move end_time backward to avoid endeless loop */
start_time
=
current_time
;
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
/* timeout! */
/* timeout! */
local_status
=
MTAPI_TIMEOUT
;
local_status
=
MTAPI_TIMEOUT
;
...
...
This diff is collapsed.
Click to expand it.
mtapi_c/src/embb_mtapi_queue_t.c
View file @
ae4813ec
...
@@ -360,10 +360,12 @@ void mtapi_queue_delete(
...
@@ -360,10 +360,12 @@ void mtapi_queue_delete(
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_duration_t
wait_duration
;
embb_duration_t
wait_duration
;
embb_time_t
start_time
;
embb_time_t
end_time
;
embb_time_t
end_time
;
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_duration_set_milliseconds
(
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_time_now
(
&
start_time
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
}
...
@@ -381,6 +383,12 @@ void mtapi_queue_delete(
...
@@ -381,6 +383,12 @@ void mtapi_queue_delete(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_time_t
current_time
;
embb_time_t
current_time
;
embb_time_now
(
&
current_time
);
embb_time_now
(
&
current_time
);
if
(
embb_time_compare
(
&
current_time
,
&
start_time
)
<
0
)
{
/* time has moved backwards, maybe a wraparound or jitter
move end_time backward to avoid endeless loop */
start_time
=
current_time
;
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
/* timeout! */
/* timeout! */
local_status
=
MTAPI_TIMEOUT
;
local_status
=
MTAPI_TIMEOUT
;
...
@@ -435,10 +443,12 @@ void mtapi_queue_disable(
...
@@ -435,10 +443,12 @@ void mtapi_queue_disable(
embb_mtapi_scheduler_get_current_thread_context
(
node
->
scheduler
);
embb_mtapi_scheduler_get_current_thread_context
(
node
->
scheduler
);
embb_duration_t
wait_duration
;
embb_duration_t
wait_duration
;
embb_time_t
start_time
;
embb_time_t
end_time
;
embb_time_t
end_time
;
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_duration_set_milliseconds
(
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_time_now
(
&
start_time
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
}
...
@@ -448,6 +458,12 @@ void mtapi_queue_disable(
...
@@ -448,6 +458,12 @@ void mtapi_queue_disable(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_time_t
current_time
;
embb_time_t
current_time
;
embb_time_now
(
&
current_time
);
embb_time_now
(
&
current_time
);
if
(
embb_time_compare
(
&
current_time
,
&
start_time
)
<
0
)
{
/* time has moved backwards, maybe a wraparound or jitter
move end_time backward to avoid endeless loop */
start_time
=
current_time
;
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
/* timeout! */
/* timeout! */
local_status
=
MTAPI_TIMEOUT
;
local_status
=
MTAPI_TIMEOUT
;
...
...
This diff is collapsed.
Click to expand it.
mtapi_c/src/embb_mtapi_scheduler_t.c
View file @
ae4813ec
...
@@ -407,6 +407,7 @@ mtapi_boolean_t embb_mtapi_scheduler_wait_for_task(
...
@@ -407,6 +407,7 @@ mtapi_boolean_t embb_mtapi_scheduler_wait_for_task(
embb_mtapi_node_t
*
node
=
embb_mtapi_node_get_instance
();
embb_mtapi_node_t
*
node
=
embb_mtapi_node_get_instance
();
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_mtapi_thread_context_t
*
context
=
NULL
;
embb_duration_t
wait_duration
;
embb_duration_t
wait_duration
;
embb_time_t
start_time
;
embb_time_t
end_time
;
embb_time_t
end_time
;
assert
(
MTAPI_NULL
!=
node
);
assert
(
MTAPI_NULL
!=
node
);
...
@@ -414,6 +415,7 @@ mtapi_boolean_t embb_mtapi_scheduler_wait_for_task(
...
@@ -414,6 +415,7 @@ mtapi_boolean_t embb_mtapi_scheduler_wait_for_task(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_duration_set_milliseconds
(
&
wait_duration
,
(
unsigned
long
long
)
timeout
);
embb_time_now
(
&
start_time
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
}
...
@@ -431,6 +433,12 @@ mtapi_boolean_t embb_mtapi_scheduler_wait_for_task(
...
@@ -431,6 +433,12 @@ mtapi_boolean_t embb_mtapi_scheduler_wait_for_task(
if
(
MTAPI_INFINITE
<
timeout
)
{
if
(
MTAPI_INFINITE
<
timeout
)
{
embb_time_t
current_time
;
embb_time_t
current_time
;
embb_time_now
(
&
current_time
);
embb_time_now
(
&
current_time
);
if
(
embb_time_compare
(
&
current_time
,
&
start_time
)
<
0
)
{
/* time has moved backwards, maybe a wraparound or jitter
move end_time backward to avoid endeless loop */
start_time
=
current_time
;
embb_time_in
(
&
end_time
,
&
wait_duration
);
}
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
if
(
embb_time_compare
(
&
current_time
,
&
end_time
)
>
0
)
{
/* timeout! */
/* timeout! */
return
MTAPI_FALSE
;
return
MTAPI_FALSE
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment