Use of External Queues

2008-01-21
2013-05-14
  • kenneth kahn
    kenneth kahn
    2008-01-21

    I'm trying to use external Queues to allow two processes on the same system to communicate with each other. I have the following sample code running on Solaris 10 using Regina 3.3:

    Child_PID = fork();
    /*-----------------------------* 
    ! Child Process ! 
    *-----------------------------*/
    If (Child_PID = 0) Then Do;
    Say " Child Process (PID="GetPID()")";
    QueueName = "CRV_"GetPID()"@wfbsun7";
    Call RxQueue 'Set',QueueName;
    Push QueueName" completed";
    End;
    /*------------------------------* 
    ! Parent Process ! 
    *------------------------------*/
    Else Do;
    Say "Parent Process (PID="GetPID()")";
    QueueName = "CRV_"Child_PID"@wfbsun7";
    Call RxQueue 'Create',QName;
    Call RxQueue 'Set',QName;
    Say "Waiting for Response from "QueueName;
    Pull Child_Responss;
    Say "Child_Response="Child_Response;
    End;
    exit 0;

    My intent is to have the parent process wait for the child process to start up, run some code, then responds back with a completion code. The above sample code doesn't work; i.e. the "Pull" in the parent process never gets posted. Am I doing something wrong? Do I not correctly understand how external queues are supposed to work? I did start "rxstack -d" before trying this. My intention is to start multiple child processes, each one with it's own external queue, and use "RxQueue" to create a separate queue for each child process and wait for each in turn, using "RxQueue 'Set'" in the parent process to set to the appropriate child queue.

     
    • kenneth kahn
      kenneth kahn
      2008-01-21

      Never mind.  I was using 'QName' instead of 'QueueName'.  I changed all references to 'QueueName' and it works as expected.