View topic - EMT Trap fault

EMT Trap fault

For discussion of realtime and/or embedded programming.

EMT Trap fault

Postby Mr.Green » Mon Apr 06, 2009 1:53 pm

Hi all,
somehow I have caused an EMT Trap fault.
I am not really sure how I did it, and until now I couldn't reproduce it.

In general: what is an EMT Trap?

I have built the following structure: a producer fills a shared memory with data and then signals a condvar. The consumer waits for this signal and consumes the data.
After I've shut down the producer the consumer fell into this EMT Trap.

The producer does the following when shutting down (signal handler for SIGTERM, SIGABRT, SIGQUIT, SIGSEGV):

Code: Select all
void sig_handler (int signo)
   //Set the status to "OFF" and signal the mutex, then remove the SHMem
   strncpy(ipc.status_ptr->status, STATE_OFF, sizeof(ipc.status_ptr->status)-1);   
   if(shm_unlink (CUST_SHM_SERVER_STATUS) != 0)
      printf("error on shm_unlink (status): %s", strerror(errno));
   if(shm_unlink (CUST_SHM_SERVER_RESULT) != 0)
      printf("error on shm_unlink (result): %s", strerror(errno));
   exit (0);

The consumer waits on these condvars via

Code: Select all
      pthread_cond_wait(&(status_ptr->head.condvar), &(status_ptr->head.mutex));

When removing a shared memory via shm_unlink, the allocated memory stays untouched, so this shouldn't be the problem.

Any ideas?
Best regards,
Active Member
Posts: 37
Joined: Tue Nov 11, 2008 12:21 pm

RE: EMT Trap fault

Postby ysinitsky » Mon Apr 06, 2009 2:29 pm

Senior Member
Posts: 164
Joined: Wed Dec 14, 2005 8:46 pm

Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 3 guests