Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
blibs
blc_program
Commits
68aa48e0
Commit
68aa48e0
authored
Apr 13, 2018
by
Arnaud Blanchard
Browse files
Clean functions
parent
e35be972
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/blc_command.cpp
View file @
68aa48e0
...
@@ -232,25 +232,6 @@ int blc_command_try_to_interpret(){
...
@@ -232,25 +232,6 @@ int blc_command_try_to_interpret(){
}
}
/// if the parameter is not null we should display the help at each command.
static
void
*
command_thread_interpret_loop
(
void
*
){
while
(
blc_status
==
BLC_RUN
){
blc_command_interpret
();
}
return
NULL
;
}
void
blc_command_interpret_thread
(
char
const
*
option
,
void
(
*
ask_quit_funcion
)()){
pthread_t
thread
;
if
(
ask_quit_funcion
==
NULL
)
ask_quit_funcion
=
blc_command_ask_quit
;
blc_command_loop_period
=-
2
;
if
(
strchr
(
option
,
'h'
))
blc_command_add
(
"h"
,
(
type_blc_command_cb
)
blc_command_display_help
,
NULL
,
"display this help"
,
NULL
);
if
(
strchr
(
option
,
'q'
))
blc_command_add
(
"q"
,
(
type_blc_command_cb
)
ask_quit_funcion
,
NULL
,
"quit the application"
,
NULL
);
SYSTEM_ERROR_CHECK
(
pthread_create
(
&
thread
,
NULL
,
command_thread_interpret_loop
,
NULL
),
-
1
,
NULL
);
}
void
blc_command_update_int_cb
(
char
const
*
argument
,
void
*
int_pt
){
void
blc_command_update_int_cb
(
char
const
*
argument
,
void
*
int_pt
){
char
*
endptr
;
char
*
endptr
;
int
value
;
int
value
;
...
...
src/blc_loop.cpp
View file @
68aa48e0
...
@@ -195,7 +195,6 @@ static void *command_thread_interpret_loop(void *){
...
@@ -195,7 +195,6 @@ static void *command_thread_interpret_loop(void *){
while
(
blc_status
!=
BLC_QUIT
){
while
(
blc_status
!=
BLC_QUIT
){
blc_command_interpret_block
();
blc_command_interpret_block
();
if
(
blc_command_loop_period
==-
1
)
BLC_PTHREAD_CHECK
(
pthread_mutex_unlock
(
&
mutex_lock_keyboard
),
NULL
);
if
(
blc_command_loop_period
==-
1
)
BLC_PTHREAD_CHECK
(
pthread_mutex_unlock
(
&
mutex_lock_keyboard
),
NULL
);
//blc_command_interpret();
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -248,7 +247,7 @@ int blc_command_loop_start(){
...
@@ -248,7 +247,7 @@ int blc_command_loop_start(){
else
if
(
blc_status
==
BLC_RUN
){
else
if
(
blc_status
==
BLC_RUN
){
//We wait for semaphore
//We wait for semaphore
FOR
(
i
,
waiting_semaphores_nb
)
{
FOR
(
i
,
waiting_semaphores_nb
)
{
blocking_semaphore
=
waiting_semaphores
[
i
];
blocking_semaphore
=
waiting_semaphores
[
i
];
//This is used to be able to unlock all blocking semaphore on quiting
SYSTEM_ERROR_CHECK
(
sem_wait
(
blocking_semaphore
),
-
1
,
NULL
);
SYSTEM_ERROR_CHECK
(
sem_wait
(
blocking_semaphore
),
-
1
,
NULL
);
}
}
blocking_semaphore
=
NULL
;
blocking_semaphore
=
NULL
;
...
...
Write
Preview
Supports
Markdown
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