![]() |
Smalltalk/X WebserverDocumentation of class 'BackgroundQueueProcessingJob': |
|
Class: BackgroundQueueProcessingJobInheritance:Object | +--AbstractBackgroundJob | +--BackgroundQueueProcessingJob
Description:A BackgroundQueueProcessingJob is a specialized form of a BackgroundJob for background processing of a queue. Each item in the queue (added by sending #add: item) is processed (using the instance variable job). Implementation notes: The thread is running only if there is at least one item to process. When the queue is empty, the thread teminates. It is started again when a new item is added to the queue. [instance variables:] queue <OrderedCollection> the queue of items to be procesed queueAccessLock<RecursionLock> a lock used to synchronize access to the queue queueProcessedSema<Semaphore> a semaphore signaled when the queue is processed (and therefore empty). [class variables:] Related information:BackgroundJob Instance protocol:adding & removing
Examples:| job text | job := BackgroundQueueProcessingJob named: 'example job' on:[:text| Delay waitForSeconds: 3. Transcript showCR:'One guy said: ', text ]. job add:'Hello world'. Delay waitForSeconds: 5. job add:'Ahoj Svete!'. job restart. Delay waitForSeconds: 1. job add:'Haya, looks like proper queue, you should see all greetings'. |
|
ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Mon, 29 May 2023 12:58:37 GMT
|