eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'OperationQueue':

Home

everywhere
www.exept.de
for:
[back]

Class: OperationQueue


Inheritance:

   Object
   |
   +--OperationQueue

Package:
stx:libbasic2
Category:
Kernel-Processes
Version:
rev: ? date: ? ?
user: ?
file: ? directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Martin Walser
Claus Gittinger

Description:


An operationQueue allows operations (i.e. actions) to be evaluated in
a first-come-first-serve queue like fashion. A single consumer process
waits for orders to be enqueued and evaluates them (as they come).
Producer processes which want to have some operation performed may
enqueue these. Producers are suspended, until the operation is finished.
If multiple orders which compare equal are enqueued by multiple producers,
the operation is only evaluated once, and both producers will wake up when
the operation has finished.


Related information:

    SharedQueue
    Queue

Private classes:

    OperationInQueue

Examples:


two orders; done sequentially:


    |opQ|

    opQ := OperationQueue new.
    opQ scheduleOperation:[ Transcript showCR:'hello world-1'].
    opQ scheduleOperation:[ Transcript showCR:'hello world-2'].



only 10 outputs (same operation entered by multiple producers):


    |p1 p2 p3 opQ order|

    opQ := OperationQueue new.
    order := [ Transcript showCR:'hello world '].
    p1 := [
            1 to:10 do:[:i |
                opQ scheduleOperation:order.
            ]
          ] fork.
    p2 := [
            1 to:10 do:[:i |
                opQ scheduleOperation:order.
            ]
          ] fork.
    p3 := [
            1 to:10 do:[:i |
                opQ scheduleOperation:order.
            ]
          ] fork.




ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 21:30:13 GMT