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
17
Issues
17
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
b6420b1a
Commit
b6420b1a
authored
Jan 09, 2018
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified margo_get_handler_pool to prevent users from changing pool
parent
84581e51
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
17 deletions
+24
-17
examples/composition/composed-svc-daemon.c
examples/composition/composed-svc-daemon.c
+4
-4
examples/multiplex/margo-example-mp-server.c
examples/multiplex/margo-example-mp-server.c
+5
-5
include/margo.h
include/margo.h
+4
-2
src/margo-timer.c
src/margo-timer.c
+4
-4
src/margo.c
src/margo.c
+7
-2
No files found.
examples/composition/composed-svc-daemon.c
View file @
b6420b1a
...
...
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
hg_addr_t
addr_self
;
char
addr_self_string
[
128
];
hg_size_t
addr_self_string_sz
=
128
;
ABT_pool
*
handler_pool
;
ABT_pool
handler_pool
;
char
*
svc_list
;
char
*
svc
;
...
...
@@ -109,17 +109,17 @@ int main(int argc, char **argv)
*/
MARGO_REGISTER
(
mid
,
"my_shutdown_rpc"
,
void
,
void
,
my_rpc_shutdown_ult
);
handler_pool
=
margo_get_handler_pool
(
mid
);
margo_get_handler_pool
(
mid
,
&
handler_pool
);
svc
=
strtok
(
svc_list
,
","
);
while
(
svc
)
{
if
(
!
strcmp
(
svc
,
"data-xfer"
))
{
data_xfer_service_register
(
mid
,
*
handler_pool
,
0
);
data_xfer_service_register
(
mid
,
handler_pool
,
0
);
}
else
if
(
!
strcmp
(
svc
,
"delegator"
))
{
delegator_service_register
(
mid
,
*
handler_pool
,
0
);
delegator_service_register
(
mid
,
handler_pool
,
0
);
}
else
assert
(
0
);
...
...
examples/multiplex/margo-example-mp-server.c
View file @
b6420b1a
...
...
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
hg_size_t
addr_self_string_sz
=
128
;
ABT_xstream
svc1_xstream2
;
ABT_pool
svc1_pool2
;
ABT_pool
*
handler_pool
;
ABT_pool
handler_pool
;
if
(
argc
!=
2
)
{
...
...
@@ -110,8 +110,8 @@ int main(int argc, char **argv)
/* register svc1, with mplex_id 1, to execute on the default handler pool
* used by Margo
*/
handler_pool
=
margo_get_handler_pool
(
mid
);
ret
=
svc1_register
(
mid
,
*
handler_pool
,
1
);
margo_get_handler_pool
(
mid
,
&
handler_pool
);
ret
=
svc1_register
(
mid
,
handler_pool
,
1
);
assert
(
ret
==
0
);
/* create a dedicated xstream and pool for another instance of svc1 */
...
...
@@ -134,8 +134,8 @@ int main(int argc, char **argv)
/* register svc2, with mplex_id 3, to execute on the default handler pool
* used by Margo
*/
handler_pool
=
margo_get_handler_pool
(
mid
);
ret
=
svc2_register
(
mid
,
*
handler_pool
,
3
);
margo_get_handler_pool
(
mid
,
&
handler_pool
);
ret
=
svc2_register
(
mid
,
handler_pool
,
3
);
assert
(
ret
==
0
);
/* shut things down */
...
...
include/margo.h
View file @
b6420b1a
...
...
@@ -711,8 +711,10 @@ void margo_thread_sleep(
* Retrieve the abt_handler pool that was associated with the instance at
* initialization time
* @param [in] mid Margo instance
* @param [out] pool handler pool
* @return 0 on success, error code on failure
*/
ABT_pool
*
margo_get_handler_pool
(
margo_instance_id
mid
);
int
margo_get_handler_pool
(
margo_instance_id
mid
,
ABT_pool
*
pool
);
/**
* Retrieve the Mercury context that was associated with this instance at
...
...
@@ -836,7 +838,7 @@ hg_return_t __name##_handler(hg_handle_t handle) { \
return(HG_INVALID_PARAM); \
}\
if(__pool == ABT_POOL_NULL) \
__pool = *margo_get_handler_pool(__mid
); \
margo_get_handler_pool(__mid, &__pool
); \
__ret = ABT_thread_create(__pool, (void (*)(void *))__name, handle, ABT_THREAD_ATTR_NULL, NULL); \
if(__ret != 0) { \
return(HG_NOMEM_ERROR); \
...
...
src/margo-timer.c
View file @
b6420b1a
...
...
@@ -142,7 +142,7 @@ void margo_check_timers(
int
ret
;
margo_timer_t
*
cur
;
struct
margo_timer_instance
*
timer_inst
;
ABT_pool
*
handler_pool
;
ABT_pool
handler_pool
;
double
now
=
ABT_get_wtime
();
timer_inst
=
margo_get_timer_instance
(
mid
);
...
...
@@ -160,10 +160,10 @@ void margo_check_timers(
cur
->
prev
=
cur
->
next
=
NULL
;
/* schedule callback on the handler pool */
handler_pool
=
margo_get_handler_pool
(
mid
);
if
(
*
handler_pool
!=
ABT_POOL_NULL
)
margo_get_handler_pool
(
mid
,
&
handler_pool
);
if
(
handler_pool
!=
ABT_POOL_NULL
)
{
ret
=
ABT_thread_create
(
*
handler_pool
,
cur
->
cb_fn
,
cur
->
cb_dat
,
ret
=
ABT_thread_create
(
handler_pool
,
cur
->
cb_fn
,
cur
->
cb_dat
,
ABT_THREAD_ATTR_NULL
,
NULL
);
assert
(
ret
==
ABT_SUCCESS
);
}
...
...
src/margo.c
View file @
b6420b1a
...
...
@@ -966,9 +966,14 @@ void margo_thread_sleep(
return
;
}
ABT_pool
*
margo_get_handler_pool
(
margo_instance_id
mid
)
int
margo_get_handler_pool
(
margo_instance_id
mid
,
ABT_pool
*
pool
)
{
return
(
&
mid
->
handler_pool
);
if
(
mid
)
{
*
pool
=
mid
->
handler_pool
;
return
0
;
}
else
{
return
-
1
;
}
}
hg_context_t
*
margo_get_context
(
margo_instance_id
mid
)
...
...
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