[Glass] Printer spooler and TransientSemaphore wait
James Foster via Glass
glass at lists.gemtalksystems.com
Tue Jul 10 08:28:06 PDT 2018
Dario,
Are you intending the semaphore to work between gems? If so, then it won’t work. A semaphore is “DbTransient,” meaning that its state is not persistent in the database. A Smalltalk Semaphore works only inside a single virtual machine (Gem).
Instead, it should be sufficient for you to use GemStone’s transaction semantics. A “producer” adds and item to an RcQueue and commits, while a “consumer” periodically aborts and looks to see if the queue is non-empty. For simplicity, the consumer should have a delay in its polling loop.
James
> On Jul 10, 2018, at 8:17 AM, dario.trussardi at tiscali.it via Glass <glass at lists.gemtalksystems.com> wrote:
>
> Ciao,
>
> in the application based on Seaside, i manage some printers devices.
>
> Every device have a RcQueue where the system add the 'works' to print.
>
> Besides there is a topaz script/server, which read the prints jobs and does the printing.
>
> Now this script is based spoolSemaphore class variable set to on TransientSemaphore,
> who waits for the presence of a new document to be reported,
>
> segnaled when one relative entry is added to one RcQueue printer device.
>
>
>
> This is the printerSpool script:
>
> startPrinterSpool
> | cllDbSpoolerActive flagLo...................... |
>
> UserGlobals at: #'FlagSpooler' put: true.
>
> spoolSemaphore := TransientSemaphore new.
>
>
> [ UserGlobals at: #'FlagSpooler' ]
> whileTrue: [
> spoolSemaphore waitForSeconds: 1.
>
> System commit. " Update the session data "
> counterLimit := DTRdbOperatingDevice ticktesForCicle.
>
> ....................
>
> .............
> If in the whileTrue loop i define the:
>
> spoolSemaphore waitForSeconds: 1.
>
> the topaz script works, but not waiting as I would like .....
>
> If in the whileTrue loop i define the:
>
> spoolSemaphore wait.
>
> the topaz script generates the error:
>
> ERROR 2366 , a ThreadError occurred (error 2366), reason:rtErrSchedulerDeadlocked, The ProcessorScheduler is deadlocked (ThreadError)
>
>
> Considerations... ?
>
> Thanks,
>
> Dario
>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20180710/73c83b6a/attachment.html>
More information about the Glass
mailing list