Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Weird (apparent) interaction between sockets and signals?: Page 1 of 4 (4 Items)
   
Weird (apparent) interaction between sockets and signals?  
We have an application where the main thread sets up a signal handling function for SIGTERM, spawns a secondary thread 
using pthread_create() and then calls pause() waiting for a SIGTERM to arrive.  The secondary thread will attempt to 
create an outgoing TCP connection (POP3), attempt to retrieve e-mails from the server, close the connection and then 
sleep for a specified interval before trying again.

The weird behavior is that if we give the invalid IP address of "0.0.0.0" everything works as expected, no e-mails are 
retrieved, but the application exits gracefully when a SIGTERM is sent to it.  However, if we have a valid IP address 
configured, the signal appears to cause the sleeping secondary thread to wake up, not the paused primary thread.  Is 
there some strange interaction between the sockets library and the signals handling code?  If so, how do we resolve this
?

Thanks,

Gordon Molek
Zebra Technologies Corp.