Commit 61ead59d authored by Robert Schmidt's avatar Robert Schmidt

Check oai_exit in wait_on_condition() and friends, no volatile

parent fffb2d14
......@@ -808,7 +808,7 @@ void logClean (void)
}
}
extern volatile int oai_exit;//extern int oai_exit;
extern int oai_exit;
void flush_mem_to_file(void)
{
int fp;
......
......@@ -71,7 +71,7 @@ pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1;
volatile int oai_exit = 0;
int oai_exit = 0;
double cpuf;
THREAD_STRUCT thread_struct;
......
......@@ -73,7 +73,7 @@ pthread_mutex_t sync_mutex;
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1;
volatile int oai_exit = 0;
int oai_exit = 0;
uint16_t sf_ahead = 4;
RU_t ru_m;
......
......@@ -80,7 +80,7 @@ static int DEFBFW[] = {0x00007fff};
#include "nfapi_interface.h"
#include <nfapi/oai_integration/vendor_ext.h>
extern volatile int oai_exit;
extern int oai_exit;
extern struct timespec timespec_sub(struct timespec lhs, struct timespec rhs);
extern struct timespec timespec_add(struct timespec lhs, struct timespec rhs);
......
......@@ -138,7 +138,7 @@ extern int rx_input_level_dBm;
extern uint64_t num_missed_slots; // counter for the number of missed slots
extern int oaisim_flag;
extern volatile int oai_exit;
extern int oai_exit;
extern openair0_config_t openair0_cfg[MAX_CARDS];
extern pthread_cond_t sync_cond;
......
......@@ -93,7 +93,7 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1;
volatile int start_gNB = 0;
volatile int oai_exit = 0;
int oai_exit = 0;
static int wait_for_sync = 0;
......
......@@ -105,7 +105,7 @@ instance_t CUuniqInstance=0;
instance_t DUuniqInstance=0;
RAN_CONTEXT_t RC;
volatile int oai_exit = 0;
int oai_exit = 0;
extern int16_t nr_dlsch_demod_shift;
......
......@@ -283,7 +283,7 @@ extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern int usrp_tx_thread;
extern uint16_t sl_ahead;
extern uint16_t sf_ahead;
extern volatile int oai_exit;
extern int oai_exit;
void tx_func(void *param);
void rx_func(void *param);
......
......@@ -59,7 +59,7 @@
uint64_t deadline,
uint64_t period);*/
extern volatile int oai_exit;
extern int oai_exit;
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
int i, r, aa, layer;
......
......@@ -44,7 +44,7 @@
#include <executables/split_headers.h>
extern WORKER_CONF_t get_thread_worker_conf(void);
extern volatile int oai_exit;
extern int oai_exit;
......
......@@ -982,13 +982,14 @@ typedef uint8_t(encoder_if_t)(uint8_t *input,
uint8_t *output,
uint8_t F);
extern int oai_exit;
static inline void wait_sync(char *thread_name) {
int rc;
printf( "waiting for sync (%s,%d/%p,%p,%p)\n",thread_name,sync_var,&sync_var,&sync_cond,&sync_mutex);
AssertFatal((rc = pthread_mutex_lock( &sync_mutex ))==0,"sync mutex lock error");
while (sync_var<0)
while (sync_var<0 && !oai_exit)
pthread_cond_wait( &sync_cond, &sync_mutex );
AssertFatal((rc = pthread_mutex_unlock( &sync_mutex ))==0,"sync mutex unlock error");
......@@ -1011,7 +1012,7 @@ static inline int wakeup_thread(pthread_mutex_t *mutex,
int sleep_cnt=0;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"wakeup_thread(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt == 0) {
while (*instance_cnt == 0 && !oai_exit) {
AssertFatal((rc = pthread_mutex_unlock(mutex))==0,"wakeup_thread(): error unlocking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
sleep_cnt++;
......@@ -1046,7 +1047,7 @@ static inline int timedwait_on_condition(pthread_mutex_t *mutex,
struct timespec now, abstime;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"[SCHED][eNB] timedwait_on_condition(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt < 0) {
while (*instance_cnt < 0 && !oai_exit) {
clock_gettime(CLOCK_REALTIME, &now);
// most of the time the thread is waiting here
// proc->instance_cnt_rxtx is -1
......@@ -1073,7 +1074,7 @@ static inline int wait_on_condition(pthread_mutex_t *mutex,
int rc;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"[SCHED][eNB] wait_on_condition(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt < 0) {
while (*instance_cnt < 0 && !oai_exit) {
// most of the time the thread is waiting here
// proc->instance_cnt_rxtx is -1
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
......@@ -1091,7 +1092,7 @@ static inline int wait_on_busy_condition(pthread_mutex_t *mutex,
int rc;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"[SCHED][eNB] wait_on_busy_condition(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt == 0) {
while (*instance_cnt == 0 && !oai_exit) {
// most of the time the thread will skip this
// waits only if proc->instance_cnt_rxtx is 0
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
......
......@@ -20,7 +20,7 @@
*/
openair0_device openair0;
volatile int oai_exit=0;
int oai_exit=0;
void exit_function(const char* file, const char* function, const int line,const char *s) {
const char * msg= s==NULL ? "no comment": s;
......
......@@ -33,7 +33,7 @@
#ifndef __NR_UNITARY_DEFS__H__
#define __NR_UNITARY_DEFS__H__
volatile int oai_exit=0;
int oai_exit=0;
void exit_function(const char* file, const char* function, const int line, const char *s) {
const char * msg= s==NULL ? "no comment": s;
......
......@@ -134,7 +134,7 @@ notifiedFIFO_t pdcp_sdu_list;
pdcp_enb_t pdcp_enb[MAX_NUM_CCs];
extern volatile int oai_exit;
extern int oai_exit;
pthread_t pdcp_stats_thread_desc;
......
......@@ -106,7 +106,7 @@ struct timing_info_t {
// Fix per CC openair rf/if device update
// extern openair0_device openair0;
extern volatile int oai_exit;
extern int oai_exit;
extern int transmission_mode;
......
......@@ -78,7 +78,7 @@ static int DEFBFW[] = {0x00007fff};
#define MBMS_EXPERIMENTAL
extern volatile int oai_exit;
extern int oai_exit;
extern clock_source_t clock_source;
#include "executables/thread-common.h"
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
......
......@@ -106,7 +106,7 @@ uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75,
uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
volatile int oai_exit = 0;
int oai_exit = 0;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
......
......@@ -146,7 +146,7 @@ extern int rx_input_level_dBm;
extern uint64_t num_missed_slots; // counter for the number of missed slots
extern int oaisim_flag;
extern volatile int oai_exit;
extern int oai_exit;
extern openair0_config_t openair0_cfg[MAX_CARDS];
extern pthread_cond_t sync_cond;
......
......@@ -99,7 +99,7 @@ int config_sync_var=-1;
uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
volatile int oai_exit = 0;
int oai_exit = 0;
unsigned int mmapped_dma=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment