Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
margo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
sds
margo
Commits
7bc62935
Commit
7bc62935
authored
Apr 18, 2016
by
Shane Snyder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorg margo timers using internal header file
parent
acef4b65
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
51 deletions
+52
-51
Makefile.am
Makefile.am
+1
-1
include/margo.h
include/margo.h
+7
-2
src/Makefile.subdir
src/Makefile.subdir
+1
-0
src/margo-timer.c
src/margo-timer.c
+0
-41
src/margo-timer.h
src/margo-timer.h
+0
-7
src/margo.c
src/margo.c
+43
-0
No files found.
Makefile.am
View file @
7bc62935
...
...
@@ -15,7 +15,7 @@ CLEANFILES = $(bin_SCRIPTS)
MAINTAINERCLEANFILES
=
EXTRA_DIST
=
BUILT_SOURCES
=
include_HEADERS
=
include/margo.h
include/margo-timer.h
include_HEADERS
=
include/margo.h
EXTRA_DIST
+=
\
prepare.sh
...
...
include/margo.h
View file @
7bc62935
...
...
@@ -17,8 +17,6 @@ extern "C" {
#include <abt.h>
#include <ev.h>
#include "margo-timer.h"
struct
margo_instance
;
typedef
struct
margo_instance
*
margo_instance_id
;
...
...
@@ -156,6 +154,13 @@ hg_return_t margo_addr_lookup(
const
char
*
name
,
hg_addr_t
*
addr
);
/**
* Suspends the calling ULT for a specified time duration
* @param [in] timeout_ms timeout duration in milliseconds
*/
void
margo_thread_sleep
(
double
timeout_ms
);
/**
* Retrive the Margo instance that has been associated with a Mercury class
* @param [in] cl Mercury class
...
...
src/Makefile.subdir
View file @
7bc62935
src_libmargo_a_SOURCES
+=
\
src/margo.c
\
src/margo-timer.h
\
src/margo-timer.c
src/margo-timer.c
View file @
7bc62935
...
...
@@ -49,47 +49,6 @@ void margo_timer_sys_shutdown()
return
;
}
typedef
struct
{
ABT_mutex
mutex
;
ABT_cond
cond
;
}
margo_thread_sleep_cb_dat
;
static
void
margo_thread_sleep_cb
(
void
*
arg
)
{
margo_thread_sleep_cb_dat
*
sleep_cb_dat
=
(
margo_thread_sleep_cb_dat
*
)
arg
;
/* wake up the sleeping thread */
ABT_mutex_lock
(
sleep_cb_dat
->
mutex
);
ABT_cond_signal
(
sleep_cb_dat
->
cond
);
ABT_mutex_unlock
(
sleep_cb_dat
->
mutex
);
return
;
}
void
margo_thread_sleep
(
double
timeout_ms
)
{
margo_timer_t
sleep_timer
;
margo_thread_sleep_cb_dat
sleep_cb_dat
;
/* set data needed for sleep callback */
ABT_mutex_create
(
&
(
sleep_cb_dat
.
mutex
));
ABT_cond_create
(
&
(
sleep_cb_dat
.
cond
));
/* initialize the sleep timer */
margo_timer_init
(
&
sleep_timer
,
margo_thread_sleep_cb
,
&
sleep_cb_dat
,
timeout_ms
);
/* yield thread for specified timeout */
ABT_mutex_lock
(
sleep_cb_dat
.
mutex
);
ABT_cond_wait
(
sleep_cb_dat
.
cond
,
sleep_cb_dat
.
mutex
);
ABT_mutex_unlock
(
sleep_cb_dat
.
mutex
);
return
;
}
void
margo_timer_init
(
margo_timer_t
*
timer
,
margo_timer_cb_fn
cb_fn
,
...
...
include
/margo-timer.h
→
src
/margo-timer.h
View file @
7bc62935
...
...
@@ -34,13 +34,6 @@ void margo_timer_sys_init(
void
margo_timer_sys_shutdown
(
void
);
/**
* Suspends the calling ULT for a specified time duration
* @param [in] timeout_ms timeout duration in milliseconds
*/
void
margo_thread_sleep
(
double
timeout_ms
);
/**
* Initializes a margo timer object which will perform some action
* after a specified time duration
...
...
src/margo.c
View file @
7bc62935
...
...
@@ -14,6 +14,7 @@
#include <math.h>
#include "margo.h"
#include "margo-timer.h"
#include "utlist.h"
/* TODO: including core.h for cancel definition, presumably this will be
...
...
@@ -455,6 +456,48 @@ hg_return_t margo_bulk_transfer(
return
(
hret
);
}
typedef
struct
{
ABT_mutex
mutex
;
ABT_cond
cond
;
}
margo_thread_sleep_cb_dat
;
static
void
margo_thread_sleep_cb
(
void
*
arg
)
{
margo_thread_sleep_cb_dat
*
sleep_cb_dat
=
(
margo_thread_sleep_cb_dat
*
)
arg
;
/* wake up the sleeping thread */
ABT_mutex_lock
(
sleep_cb_dat
->
mutex
);
ABT_cond_signal
(
sleep_cb_dat
->
cond
);
ABT_mutex_unlock
(
sleep_cb_dat
->
mutex
);
return
;
}
void
margo_thread_sleep
(
double
timeout_ms
)
{
margo_timer_t
sleep_timer
;
margo_thread_sleep_cb_dat
sleep_cb_dat
;
/* set data needed for sleep callback */
ABT_mutex_create
(
&
(
sleep_cb_dat
.
mutex
));
ABT_cond_create
(
&
(
sleep_cb_dat
.
cond
));
/* initialize the sleep timer */
margo_timer_init
(
&
sleep_timer
,
margo_thread_sleep_cb
,
&
sleep_cb_dat
,
timeout_ms
);
/* yield thread for specified timeout */
ABT_mutex_lock
(
sleep_cb_dat
.
mutex
);
ABT_cond_wait
(
sleep_cb_dat
.
cond
,
sleep_cb_dat
.
mutex
);
ABT_mutex_unlock
(
sleep_cb_dat
.
mutex
);
return
;
}
margo_instance_id
margo_hg_class_to_instance
(
hg_class_t
*
cl
)
{
int
i
;
...
...
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