Manage a Printer device with Semaphore forMutualExclusion
Ciao, I work with a seaside application. I have a printer device and i need to manage the use of it at one work at time. I think to use one Semaphore forMutualExclusion defined as variable of the specific printerTicket device Now i defined this code to mange the access : aPrinterTicket accessSema critical:[ stampaok:= [ " i open a IP connection on the device. do the printer and manage relative errors " TicketBaseTipoCentriCarico newOn: dcmModel dettagli: tfDettagli onPrinter: aPrinterTicket ] on: Error do: [:ex | " for error i open dialog to advise the operator " self jqDialog: (DTRCassaDialogConferma openOnException: ex onModel: dcmModel). " repeat until the printer is do without error " ex retry ] ]. " When the printer is do i advise the operator of it and allow the next request " stampaok ifTrue: [self jqDialog:(DTRCassaDialogConferma openOnModel: dcmModel) title: 'Ordinazione confermata']. ] With this code the printer semaphore don't work. The semaphore don't manage the code of the request, and when i have a error, at any loop the excessSignal of the printer semaphore is incremented. Any idea ? Thanks, Dario
Ciao,
I work with a seaside application.
I would to hear that. I wish your success.
I have a printer device and i need to manage the use of it at one work at time.
I think to use one Semaphore forMutualExclusion defined as variable of the specific printerTicket device
Now i defined this code to mange the access :
aPrinterTicket accessSema critical:[
Transcript show?
stampaok:= [ " i open a IP connection on the device. do the printer and manage relative errors " TicketBaseTipoCentriCarico newOn: dcmModel dettagli: tfDettagli onPrinter: aPrinterTicket ]
on: Error do: [:ex | " for error i open dialog to advise the operator " self jqDialog: (DTRCassaDialogConferma openOnException: ex onModel: dcmModel).
" repeat until the printer is do without error " ex retry ] ].
where do you execute stampaok I do not see a value.
" When the printer is do i advise the operator of it and allow the next request " stampaok ifTrue: [self jqDialog:(DTRCassaDialogConferma openOnModel: dcmModel) title: 'Ordinazione confermata']. ]
With this code the printer semaphore don't work.
The semaphore don't manage the code of the request,
did you try to put a transcript
and when i have a error, at any loop the excessSignal of the printer semaphore is incremented.
Any idea ?
Thanks,
Dario
participants (2)
-
Dario Trussardi -
Stéphane Ducasse