ussd

Block Closure and Timeouts

Tagged:  •  

For the SS7/GSM work I am doing I have to implement dialogues with other systems and by default the IO in a lightweight process in Smalltalk is blocking (built on top of SIGIO). My problem is that a remote system could make me wait for a response forever. I am not an experienced Smalltalker yet but the existing options didn't look good enough (which might be me being unexperienced). I looked into what is required to add a #timeout:do: to the BlockClosure. The idea is to run the dialogue in a very straight forward way and guard the whole operation with a Timeout.


[
self sendSomething.
self waitForResponseOfKind: ABC.
self someMoreStuff.
self waitForMoe.
self askOtherSystem.
self conclude.
] timeout: 10 do: ['The operation timed out... cleanup']

Syndicate content

User login