Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
margo
Commits
143c1eae
Commit
143c1eae
authored
Aug 22, 2017
by
Shane Snyder
Browse files
define margo client/server mode
parent
bbe73599
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/margo.h
View file @
143c1eae
...
...
@@ -29,13 +29,17 @@ typedef struct margo_instance* margo_instance_id;
typedef
struct
margo_data
*
margo_data_ptr
;
#define MARGO_INSTANCE_NULL ((margo_instance_id)NULL)
#define MARGO_CLIENT_MODE 0
#define MARGO_SERVER_MODE 1
#define MARGO_DEFAULT_MPLEX_ID 0
#define MARGO_RPC_ID_IGNORE ((hg_id_t*)NULL)
/**
* Initializes margo library.
* @param [in] addr_str Mercury host address with port number
* @param [in] listen_flag Boolean flag to listen for incoming connections
* @param [in] mode Mode to run Margo in:
* - MARGO_CLIENT_MODE
* - MARGO_SERVER_MODE
* @param [in] use_progress_thread Boolean flag to use a dedicated thread for
* running Mercury's progress loop. If false,
* it will run in the caller's thread context.
...
...
@@ -56,7 +60,7 @@ typedef struct margo_data* margo_data_ptr;
*/
margo_instance_id
margo_init
(
const
char
*
addr_str
,
int
listen_flag
,
int
mode
,
int
use_progress_thread
,
int
rpc_thread_count
);
...
...
src/margo.c
View file @
143c1eae
...
...
@@ -79,8 +79,7 @@ static void hg_progress_fn(void* foo);
static
int
margo_xstream_is_in_progress_pool
(
margo_instance_id
mid
);
static
void
margo_rpc_data_free
(
void
*
ptr
);
/* XXX: maybe instead of listen_flag, we can specify either CLIENT or SERVER mode? */
margo_instance_id
margo_init
(
const
char
*
addr_str
,
int
listen_flag
,
margo_instance_id
margo_init
(
const
char
*
addr_str
,
int
mode
,
int
use_progress_thread
,
int
rpc_thread_count
)
{
ABT_xstream
progress_xstream
=
ABT_XSTREAM_NULL
;
...
...
@@ -90,10 +89,13 @@ margo_instance_id margo_init(const char *addr_str, int listen_flag,
ABT_pool
rpc_pool
=
ABT_POOL_NULL
;
hg_class_t
*
hg_class
=
NULL
;
hg_context_t
*
hg_context
=
NULL
;
int
listen_flag
=
(
mode
==
MARGO_CLIENT_MODE
)
?
HG_FALSE
:
HG_TRUE
;
int
i
;
int
ret
;
struct
margo_instance
*
mid
=
MARGO_INSTANCE_NULL
;
if
(
mode
!=
MARGO_CLIENT_MODE
||
mode
!=
MARGO_SERVER_MODE
)
goto
err
;
ret
=
ABT_init
(
0
,
NULL
);
/* XXX: argc/argv not currently used by ABT ... */
if
(
ret
!=
0
)
goto
err
;
...
...
@@ -115,7 +117,7 @@ margo_instance_id margo_init(const char *addr_str, int listen_flag,
if
(
ret
!=
ABT_SUCCESS
)
goto
err
;
}
if
(
listen_flag
)
if
(
mode
==
MARGO_SERVER_MODE
)
{
if
(
rpc_thread_count
>
0
)
{
...
...
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