mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
ccnl: prevent race condition on teardown
This commit is contained in:
parent
9b5eedeea8
commit
7c10101e83
@ -413,19 +413,23 @@ void ccnl_riot_relay_start(void)
|
||||
|
||||
ccnl_core_cleanup(theRelay);
|
||||
|
||||
mutex_lock(&theRelay->stop_lock);
|
||||
ccnl_free(theRelay);
|
||||
}
|
||||
|
||||
void ccnl_riot_relay_helper_start(void)
|
||||
{
|
||||
unsigned long us = CCNL_CHECK_RETRANSMIT_USEC;
|
||||
mutex_lock(&theRelay->stop_lock);
|
||||
while (!theRelay->halt_flag) {
|
||||
vtimer_usleep(us);
|
||||
|
||||
mutex_lock(&theRelay->global_lock);
|
||||
ccnl_run_events();
|
||||
mutex_unlock(&theRelay->global_lock);
|
||||
|
||||
vtimer_usleep(us);
|
||||
}
|
||||
|
||||
mutex_unlock(&theRelay->stop_lock);
|
||||
}
|
||||
|
||||
// eof
|
||||
|
@ -107,6 +107,7 @@ struct ccnl_relay_s {
|
||||
int riot_pid;
|
||||
int riot_helper_pid;
|
||||
mutex_t global_lock;
|
||||
mutex_t stop_lock;
|
||||
};
|
||||
|
||||
struct ccnl_buf_s {
|
||||
|
Loading…
Reference in New Issue
Block a user