Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
margo
Commits
3c2ca152
Commit
3c2ca152
authored
Mar 31, 2016
by
Philip Carns
Browse files
logic to find operations to cancel
parent
3f3ad28f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/margo.c
View file @
3c2ca152
...
...
@@ -199,6 +199,8 @@ static void hg_progress_fn(void* foo)
unsigned
int
actual_count
;
struct
margo_instance
*
mid
=
(
struct
margo_instance
*
)
foo
;
size_t
size
;
struct
timespec
now
;
struct
timed_element
*
cur
;
while
(
!
mid
->
hg_progress_shutdown_flag
)
{
...
...
@@ -225,6 +227,23 @@ static void hg_progress_fn(void* foo)
}
}
clock_gettime
(
clk_id
,
&
now
);
ABT_mutex_lock
(
mid
->
timer_mutex
);
while
(
mid
->
timer_head
&&
(
mid
->
timer_head
->
expiration
.
tv_sec
<
now
.
tv_sec
||
(
mid
->
timer_head
->
expiration
.
tv_sec
==
now
.
tv_sec
&&
mid
->
timer_head
->
expiration
.
tv_nsec
<
now
.
tv_nsec
)))
{
cur
=
mid
->
timer_head
;
DL_DELETE
(
mid
->
timer_head
,
cur
);
cur
->
next
=
NULL
;
cur
->
prev
=
NULL
;
/* TODO: actually cancel here, of course */
printf
(
"FOO: I would like to cancel operation with tv_sec %ld, tv_nsec %ld
\n
"
,
(
long
)
cur
->
expiration
.
tv_sec
,
cur
->
expiration
.
tv_nsec
);
}
ABT_mutex_unlock
(
mid
->
timer_mutex
);
/* TODO: check for timeouts here. If timer_head not null, then check
* current time and compare against first element. Keep walking list
* cancelling operations until we find non-expired element.
...
...
@@ -326,9 +345,10 @@ hg_return_t margo_forward_timed(
hret
=
*
waited_hret
;
}
/* remove timer */
/* remove timer
if it is still in place
*/
ABT_mutex_lock
(
mid
->
timer_mutex
);
DL_DELETE
(
mid
->
timer_head
,
&
el
);
if
(
el
.
prev
||
el
.
next
)
DL_DELETE
(
mid
->
timer_head
,
&
el
);
ABT_mutex_unlock
(
mid
->
timer_mutex
);
ABT_eventual_free
(
&
eventual
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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