Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Beam Positoning Monitor - Software
Commits
8f7a4a82
Commit
8f7a4a82
authored
May 21, 2015
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/{dev_io,sm_io}/*: update zthread to zactor API (CZMQ 3.0.0)
parent
6b83d03c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
7 deletions
+39
-7
dev_io_core.c
src/dev_io/dev_io_core.c
+13
-3
sm_io_bootstrap.c
src/sm_io/sm_io_bootstrap.c
+25
-3
sm_io_bootstrap.h
src/sm_io/sm_io_bootstrap.h
+1
-1
No files found.
src/dev_io/dev_io_core.c
View file @
8f7a4a82
...
...
@@ -306,11 +306,21 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint64_t base,
th_config_args
->
log_file
=
self
->
log_file
;
th_config_args
->
inst_id
=
inst_id
;
/* Create
detached thread
just for configuring the new recently created SMIO */
z
err
=
zthread
_new
(
smio_config_defaults
,
th_config_args
);
ASSERT_TEST
(
zerr
==
0
,
"Could not spawn config thread"
,
/* Create
actor
just for configuring the new recently created SMIO */
z
actor_t
*
config_actor
=
zactor
_new
(
smio_config_defaults
,
th_config_args
);
ASSERT_TEST
(
config_actor
!=
NULL
,
"Could not spawn config thread"
,
err_spawn_config_thread
);
/* Ok, we've created our actor. Now, we wait for it to signal its end */
zsock_wait
(
config_actor
);
/* Now, we send a TERM message to the actor, indicating we want it to
* end */
zerr
=
zstr_sendx
(
config_actor
,
"$TERM"
,
NULL
);
/* ASSERT_TEST (zerr != -1, "Could send $TERM message to actor",
err_end_config_thread); */
/* Lastly, destroy the actor */
zactor_destroy
(
&
config_actor
);
/* stop on first match */
break
;
}
...
...
src/sm_io/sm_io_bootstrap.c
View file @
8f7a4a82
...
...
@@ -130,9 +130,11 @@ err_inst_id_str_alloc:
/************************************************************/
/*************** SMIO Config Thread entry-point ************/
/************************************************************/
void
*
smio_config_defaults
(
void
*
args
)
void
smio_config_defaults
(
zsock_t
*
pipe
,
void
*
args
)
{
th_config_args_t
*
th_args
=
(
th_config_args_t
*
)
args
;
/* Signal parent we are initializing */
zsock_signal
(
pipe
,
0
);
/* We must export our service as the combination of the
* devio name (coming from devio parent) and our own name ID
...
...
@@ -151,14 +153,34 @@ void *smio_config_defaults (void *args)
SMIO_DISPATCH_FUNC_WRAPPER_GEN
(
config_defaults
,
th_args
->
broker
,
smio_service
,
th_args
->
log_file
);
/* We've finished configuring the SMIO. Tell DEVIO we are done */
zsock_signal
(
pipe
,
0
);
/* Wait for $TERM message from DEVIO to end */
bool
terminated
=
false
;
while
(
!
terminated
)
{
zmsg_t
*
msg
=
zmsg_recv
(
pipe
);
if
(
msg
==
NULL
)
{
break
;
/* Interrupted */
}
char
*
command
=
zmsg_popstr
(
msg
);
if
(
streq
(
command
,
"$TERM"
))
{
terminated
=
true
;
}
free
(
command
);
zmsg_destroy
(
&
msg
);
}
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_INFO
,
"[sm_io_bootstrap] Config Thread %s "
"exiting
\n
"
,
smio_service
);
"terminating with %s
\n
"
,
smio_service
,
(
terminated
)
?
"success"
:
"error"
);
free
(
smio_service
);
err_smio_service_alloc:
free
(
inst_id_str
);
err_inst_id_str_alloc:
free
(
th_args
);
return
NULL
;
}
/************************************************************/
...
...
src/sm_io/sm_io_bootstrap.h
View file @
8f7a4a82
...
...
@@ -87,7 +87,7 @@ typedef struct _th_config_args_t th_config_args_t;
/************************ Our methods ***********************/
/************************************************************/
void
smio_startup
(
zsock_t
*
pipe
,
void
*
args
);
void
*
smio_config_defaults
(
void
*
args
);
void
smio_config_defaults
(
zsock_t
*
pipe
,
void
*
args
);
struct
_smio_t
*
smio_new
(
th_boot_args_t
*
args
,
zsock_t
*
pipe
,
char
*
service
);
smio_err_e
smio_destroy
(
struct
_smio_t
**
self_p
);
smio_err_e
smio_loop
(
struct
_smio_t
*
self
);
...
...
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