Commit 7b387999 authored by RS's avatar RS

Replaced usleep with semaphore for current_sfn_sf

parent 9a8880fd
......@@ -49,6 +49,7 @@ queue_t ul_config_req_queue;
queue_t hi_dci0_req_queue;
int current_sfn_sf;
sem_t sfn_semaphore;
static int ue_tx_sock_descriptor = -1;
static int ue_rx_sock_descriptor = -1;
......@@ -1203,6 +1204,12 @@ void *ue_standalone_pnf_task(void *context)
uint16_t sfn_sf = 0;
memcpy((void *)&sfn_sf, buffer, sizeof(sfn_sf));
current_sfn_sf = sfn_sf;
if (sem_post(&sfn_semaphore) != 0)
{
LOG_E(MAC, "sem_post() error\n");
abort();
}
}
else
{
......
......@@ -14,6 +14,7 @@
#include "nfapi_interface.h"
#include "nfapi_pnf_interface.h"
#include <pthread.h>
#include <semaphore.h>
#include "nfapi/oai_integration/vendor_ext.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
//#include "openair1/PHY/defs.h"
......@@ -156,4 +157,6 @@ extern nfapi_hi_dci0_request_t* hi_dci0_req;
extern int current_sfn_sf;
extern sem_t sfn_semaphore;
#endif /* PHY_STUB_UE_H_ */
......@@ -1043,7 +1043,11 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
bool sent_any = false;
int sfn_sf = current_sfn_sf;
if (sfn_sf == last_sfn_sf) {
usleep(100);
if (sem_wait(&sfn_semaphore) != 0)
{
LOG_E(MAC, "sem_wait() error\n");
abort();
}
continue;
}
......
......@@ -733,7 +733,15 @@ int main( int argc, char **argv ) {
init_queue(&tx_req_pdu_queue);
init_queue(&hi_dci0_req_queue);
init_queue(&ul_config_req_queue);
config_sync_var=0;
if (sem_init(&sfn_semaphore, 0, 0) != 0)
{
LOG_E(MAC, "sem_init() error\n");
abort();
}
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_standalone_thread();
} else {
......
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