Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
remi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
remi
Commits
0948ea23
Commit
0948ea23
authored
Aug 10, 2018
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added method to free user arguments
parent
76c47a56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
examples/server.c
examples/server.c
+1
-1
include/remi/remi-server.h
include/remi/remi-server.h
+9
-0
src/remi-client.cpp
src/remi-client.cpp
+3
-1
src/remi-server.cpp
src/remi-server.cpp
+9
-0
No files found.
examples/server.c
View file @
0948ea23
...
...
@@ -71,7 +71,7 @@ int main(int argc, char** argv)
// create migration class
ret
=
remi_provider_register_migration_class
(
remi_prov
,
"my_migration_class"
,
my_migration_callback
,
NULL
);
"my_migration_class"
,
my_migration_callback
,
NULL
,
NULL
);
if
(
ret
!=
REMI_SUCCESS
)
{
fprintf
(
stderr
,
"ERROR: remi_provider_register_migration_class() returned %d
\n
"
,
ret
);
ret
=
-
1
;
...
...
include/remi/remi-server.h
View file @
0948ea23
...
...
@@ -30,6 +30,13 @@ typedef struct remi_provider* remi_provider_t;
typedef
void
(
*
remi_migration_callback_t
)(
remi_fileset_t
,
void
*
);
#define REMI_MIGRATION_CALLBACK_NULL ((remi_migration_callback_t)0)
/**
* @brief Type of callback called on void* user arguments when the
* provider is destroyed.
*/
typedef
void
(
*
remi_uarg_free_t
)(
void
*
);
/**
* @brief Registers a new REMI provider. The provider will be
* automatically destroyed upon finalizing the margo instance.
...
...
@@ -54,6 +61,7 @@ int remi_provider_register(
* @param[in] provider Provider in which to register a migration class.
* @param[in] class_name Migration class name.
* @param[in] callback Callback to call after migration of a fileset of this class.
* @param[in] free_fn Function to call on uargs when the provider is destroyed.
* @param[in] uargs User-argument to pass to the callback.
*
* @return REMI_SUCCESS or error code defined in remi-common.h.
...
...
@@ -62,6 +70,7 @@ int remi_provider_register_migration_class(
remi_provider_t
provider
,
const
char
*
class_name
,
remi_migration_callback_t
callback
,
remi_uarg_free_t
free_fn
,
void
*
uargs
);
#if defined(__cplusplus)
...
...
src/remi-client.cpp
View file @
0948ea23
...
...
@@ -163,7 +163,9 @@ extern "C" int remi_fileset_migrate(
}
// expose the segments for bulk operations
auto
localBulk
=
ph
->
m_client
->
m_engine
->
expose
(
theData
,
tl
::
bulk_mode
::
read_only
);
tl
::
bulk
localBulk
;
if
(
theData
.
size
()
!=
0
)
localBulk
=
ph
->
m_client
->
m_engine
->
expose
(
theData
,
tl
::
bulk_mode
::
read_only
);
// send the RPC
auto
localRoot
=
fileset
->
m_root
;
...
...
src/remi-server.cpp
View file @
0948ea23
...
...
@@ -22,6 +22,7 @@ namespace tl = thallium;
struct
migration_class
{
remi_migration_callback_t
m_callback
;
remi_uarg_free_t
m_free
;
void
*
m_uargs
;
};
...
...
@@ -148,7 +149,13 @@ struct remi_provider : public tl::provider<remi_provider> {
static
void
on_finalize
(
void
*
uargs
)
{
auto
provider
=
static_cast
<
remi_provider_t
>
(
uargs
);
for
(
auto
&
klass
:
provider
->
m_migration_classes
)
{
if
(
klass
.
second
.
m_free
!=
nullptr
)
{
klass
.
second
.
m_free
(
klass
.
second
.
m_uargs
);
}
}
delete
provider
->
m_engine
;
delete
provider
;
}
extern
"C"
int
remi_provider_register
(
...
...
@@ -169,6 +176,7 @@ extern "C" int remi_provider_register_migration_class(
remi_provider_t
provider
,
const
char
*
class_name
,
remi_migration_callback_t
callback
,
remi_uarg_free_t
free_fn
,
void
*
uargs
)
{
if
(
provider
==
REMI_PROVIDER_NULL
||
class_name
==
NULL
)
...
...
@@ -178,5 +186,6 @@ extern "C" int remi_provider_register_migration_class(
auto
&
klass
=
provider
->
m_migration_classes
[
class_name
];
klass
.
m_callback
=
callback
;
klass
.
m_uargs
=
uargs
;
klass
.
m_free
=
free_fn
;
return
REMI_SUCCESS
;
}
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