Hi Paolo,
I would like to write code like this:
[
self sendStuff
self handleReply
self sendStuff
self handleReply
success...
] timeout: 10 do: [didn't finish]
My first idea was to do something like this:
BlockClosure extend [
timeout: aDelay do: aBlock [
| ctx ret |
ctx := thisContext.
[
[TimeOutHandler with: self on: ctx delay: aDelay] fork.
ret := self value.
] on: TimeOutOccured: [:e | aBlock value]
^ ret
]
]
and TimeOutHandler would use process queueInterrupt: [TimeOutOccured signal].
This all looks quite nice but what if I write code like this?
[
[] whileTrue: [
[
self handleReply
] on: (Pokemon)Exception do: [].
]
] timeout: 10 do: []
So my questions are. Is there a kind of Exception that can be thrown but not
caught by a 'imprecise' on:do? E.g. this exception can only be handled by this
specific handler? Or should I use thisContext and play with the IP or is this
whole idea just not the right thing to be done in smalltalk?
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk