CB900F has asked for the wisdom of the Perl Monks concerning the following question:

Hello fellow monks,
I'm implementing a message queue using IPC::MSG and IPC::SysV. I can create the queue and talk between processes, but I don't want a blocking msgrcv call, I pass it a IPC_NOWAIT flag, but still it blocks. Any ideas?
Here's some snippits..
my $id = msgget($key, IPC_CREAT | S_IRWXU);
...
if(msgrcv($id, $rcvd, 512, 0, IPC_NOWAIT)) <-- Blocks here.

Replies are listed 'Best First'.
Re: IPC Message Queues with IPC_NOWAIT
by waswas-fng (Curate) on Dec 09, 2003 at 19:33 UTC
    IPC::MSG exposes rcv() which calls msgrcv internally, are you sure you are using IPC::MSG? =)


    -Waswas
      Busted, this is my first IPC app. I did some testing and did remove the IPC::MSG and no I am not using that module. It's just the IPC::SysV. But I still cannot pass it the flag of IPC_NOWAIT to the msgrcv function. (Well I should say, I can pass it that, but it's not making a difference...) Thanks,
        Post some code, I want to see hw you are importing the IPC_NOWAIT flag and the rest of the setup of the objects. Also what OS are you doing this on?


        -Waswas