Skip to content

Commit

Permalink
dd
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed May 30, 2024
1 parent f1399c4 commit a6176d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions messaging/impl_msgq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ int MSGQSubSocket::connect(Context *context, std::string endpoint, std::string a

Message * MSGQSubSocket::receive(bool non_blocking){
msgq_do_exit = 0;
timeout = 100;

void (*prev_handler_sigint)(int);
void (*prev_handler_sigterm)(int);
Expand Down
3 changes: 3 additions & 0 deletions messaging/msgq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SharedMemory::SharedMemory(const std::string &name, size_t size) :shm_name(name)
shm_ptr = mmap(0, shm_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
assert(shm_ptr != MAP_FAILED);

printf("before init\n");
sem_t *sem = sem_open(SEMAPHORE_NAME, O_CREAT, 0644, 1);
assert(sem != SEM_FAILED);
sem_wait(sem); // Lock semaphore
Expand Down Expand Up @@ -73,6 +74,7 @@ SharedMemory::SharedMemory(const std::string &name, size_t size) :shm_name(name)
}
sem_post(sem); // Unlock semaphore
sem_close(sem);
printf("after init\n");
}

SharedMemory::~SharedMemory() {
Expand Down Expand Up @@ -439,6 +441,7 @@ int msgq_msg_recv(msgq_msg_t * msg, msgq_queue_t * q){
}

int msgq_poll(msgq_pollitem_t * items, size_t nitems, int timeout){
timeout = 100;
int num = 0;
// Check if messages ready
for (size_t i = 0; i < nitems; i++) {
Expand Down

0 comments on commit a6176d3

Please sign in to comment.