Find the answer to your Linux question:
Results 1 to 2 of 2
I have a 'c' program that has issued a msgrcv call to wait for an incoming message. Is there some way to interrupt the call (from another thread), if no ...
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    4

    How to interrupt msgrcv waiting for msg

    I have a 'c' program that has issued a msgrcv call to wait for an incoming message. Is there some way to interrupt the call (from another thread), if no message ever comes?

    I am not that familiar with signals. Could a signal be used from a different thread?

    Thanks...wish I were cruising....

  2. #2
    Just Joined!
    Join Date
    Apr 2007
    Posts
    4

    Figured it out

    After playing with signals, I finally figured this out. I was trying to use the 'raise' system call from a thread but it was not interrupting the msgrcv call. The problem is that 'raise' delivers the signal to the thread and not the process.

    When you use system call "kill(getpid(), SIGINT );" it will deliver the signal to the process and interupt the msgrcv call. You have to make sure to catch the SIGINT so your program doesn't abort.

    wish I were cruising..........

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...