Check oai_exit in wait_on_condition() and friends, no volatile

This commit is contained in:
Robert Schmidt
2022-08-16 14:44:22 +02:00
parent fffb2d14de
commit 61ead59d13
19 changed files with 24 additions and 23 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+6 -5
View File
@@ -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
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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];
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;