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
18
Issues
18
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
8ca94fd9
Commit
8ca94fd9
authored
Feb 27, 2017
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up margo mplex registration
parent
0b7c3064
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
22 deletions
+19
-22
examples/multiplex/margo-example-mp-server.c
examples/multiplex/margo-example-mp-server.c
+2
-0
examples/multiplex/svc1.c
examples/multiplex/svc1.c
+4
-22
include/margo.h
include/margo.h
+13
-0
No files found.
examples/multiplex/margo-example-mp-server.c
View file @
8ca94fd9
...
...
@@ -142,6 +142,8 @@ int main(int argc, char **argv)
*/
margo_wait_for_finalize
(
mid
);
svc1_deregister
(
mid
,
margo_get_handler_pool
(
mid
),
1
);
ABT_finalize
();
HG_Context_destroy
(
hg_context
);
...
...
examples/multiplex/svc1.c
View file @
8ca94fd9
...
...
@@ -22,6 +22,7 @@ static void svc1_do_thing_ult(hg_handle_t handle)
ret
=
HG_Get_input
(
handle
,
&
in
);
assert
(
ret
==
HG_SUCCESS
);
/* TODO: print handler name, mplex_id, and pool */
printf
(
"Got RPC request with input_val: %d
\n
"
,
in
.
input_val
);
out
.
ret
=
0
;
...
...
@@ -73,6 +74,7 @@ static void svc1_do_other_thing_ult(hg_handle_t handle)
ret
=
HG_Get_input
(
handle
,
&
in
);
assert
(
ret
==
HG_SUCCESS
);
/* TODO: print handler name, mplex_id, and pool */
printf
(
"Got RPC request with input_val: %d
\n
"
,
in
.
input_val
);
out
.
ret
=
0
;
...
...
@@ -111,28 +113,8 @@ DEFINE_MARGO_RPC_HANDLER(svc1_do_other_thing_ult)
int
svc1_register
(
margo_instance_id
mid
,
ABT_pool
pool
,
uint32_t
mplex_id
)
{
hg_return_t
hret
;
hg_id_t
id
;
hg_bool_t
flag
;
int
ret
;
/* TODO: the following, for each function */
/* TODO: this should be a macro really */
hret
=
HG_Registered_name
(
margo_get_class
(
mid
),
"svc1_do_thing"
,
&
id
,
&
flag
);
if
(
hret
!=
HG_SUCCESS
)
{
return
(
-
1
);
}
if
(
!
flag
)
{
id
=
MERCURY_REGISTER
(
margo_get_class
(
mid
),
"svc1_do_thing"
,
svc1_do_thing_in_t
,
svc1_do_thing_out_t
,
svc1_do_thing_ult_handler
);
}
ret
=
margo_register_mplex
(
mid
,
id
,
mplex_id
,
pool
);
if
(
ret
<
0
)
{
return
(
ret
);
}
MARGO_REGISTER
(
mid
,
"svc1_do_thing"
,
svc1_do_thing_in_t
,
svc1_do_thing_out_t
,
svc1_do_thing_ult_handler
,
mplex_id
,
pool
);
MARGO_REGISTER
(
mid
,
"svc1_do_other_thing"
,
svc1_do_other_thing_in_t
,
svc1_do_other_thing_out_t
,
svc1_do_other_thing_ult_handler
,
mplex_id
,
pool
);
return
(
0
);
}
...
...
include/margo.h
View file @
8ca94fd9
...
...
@@ -208,6 +208,19 @@ int margo_register_mplex(margo_instance_id mid, hg_id_t id, uint32_t mplex_id, A
*/
int
margo_lookup_mplex
(
margo_instance_id
mid
,
hg_id_t
id
,
uint32_t
mplex_id
,
ABT_pool
*
pool
);
#define MARGO_REGISTER(__mid, __func_name, __in_t, __out_t, __handler, __mplex_id, __pool) do { \
hg_return_t __hret; \
hg_id_t __id; \
hg_bool_t __flag; \
int __ret; \
__hret = HG_Registered_name(margo_get_class(__mid), __func_name, &__id, &__flag); \
assert(__hret == HG_SUCCESS); \
if(!__flag) \
__id = MERCURY_REGISTER(margo_get_class(__mid), __func_name, __in_t, __out_t, __handler); \
__ret = margo_register_mplex(__mid, __id, __mplex_id, __pool); \
assert(__ret = 0); \
} while(0)
/**
* macro that defines a function to glue an RPC handler to a ult handler
* @param [in] __name name of handler function
...
...
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