How to use "named" queues ?

Help
Vladimir
2009-11-01
2012-08-14
  • Vladimir
    Vladimir
    2009-11-01

    Hello,

    It's not clear how to use "named" queues in multithreaded
    environment such oorexx:

    If one of the thread creates and sets queue 'A' via rxqueue and is working
    with it via queue or pull and another thread is doing the same with queue 'B'
    simultaneously then the first and second threads influence to each other. So
    the contents of the queues 'A' and 'B' will be unpredictable.

    The question is:

    How to provide correct work with "named" queues that are running simultaneously without serialization of the queues?

    Thank you in advance,

    Vladimir

    P.S. Simple code and trace are below:

    --trace i

    world=.WorldObject~new

    msg=world~start("hello")

    say msg~result

    do forever

    q = RXQUEUE("Get")

    if q \= "SESSION" then leave

    end

    say q

    exit

    ::class 'WorldObject' public

    ::method hello

    trace i

    reply "Starting ..."

    Call SysSleep 1

    newq = RXQUEUE("Create")

    oldq = RXQUEUE("Set", newq)

    rc = RXQUEUE("Delete",newq)

    oldq1 = RXQUEUE("Set", oldq)

    return

    /*

    21 - reply "Starting ..."

    >L> "Starting ..."

    >>> "Starting ..."

    23 - Call SysSleep 1

    >L> "1"

    >A> "1"

    Starting ...

    >>> "0"

    25 - newq = RXQUEUE("Create")

    >L> "Create"

    >A> "Create"

    >F> RXQUEUE => "S00000000Q00920398"

    >>> "S00000000Q00920398"

    >=> NEWQ <= "S00000000Q00920398"

    26 - oldq = RXQUEUE("Set", newq)

    >L> "Set"

    >A> "Set"

    >V> NEWQ => "S00000000Q00920398"

    >A> "S00000000Q00920398"

    >F> RXQUEUE => "SESSION"

    >>> "SESSION"

    >=> OLDQ <= "SESSION"

    27 - rc = RXQUEUE("Delete",newq)

    >L> "Delete"

    >A> "Delete"

    S00000000Q00920398

    >V> NEWQ => "S00000000Q00920398"

    >A> "S00000000Q00920398"

    >F> RXQUEUE => "0"

    >>> "0"

    >=> RC <= "0"

    28 - oldq1 = RXQUEUE("Set", oldq)

    >L> "Set"

    >A> "Set"

    >V> OLDQ => "SESSION"

    >A> "SESSION"

    >F> RXQUEUE => "S00000000Q00920398"

    >>> "S00000000Q00920398"

    >=> OLDQ1 <= "S00000000Q00920398"

    30 - return

    Press ENTER key to exit...

    */

     
  • Rick McGuire
    Rick McGuire
    2009-11-01

    Rather than use rxqueue('SET'), directly create instances of the RexxQueue
    class and use the methods rather than instructions to manipulate the queues.

     
  • Vladimir
    Vladimir
    2009-11-01

    Thank you, I missed it (RexxQueue class) looking only in Queue class.