smalltalk - Defining a maximum running time for a process -
i need stop process running longer n seconds, here's thought i'd do:
|aprocess| aprocess := [ 10000 timesrepeat: [transcript show: 'x'] ] fork. [(delay forseconds: 1) wait. aprocess terminate] fork. i thought proper way proceed, seems fail time time, transcript goes on printing xes. bugs me work , can't figure out work/fail pattern is.
this in library, don't need reinvent it.
[10000 timesrepeat: [transcript show: 'x']] valuewithin: 1 second ontimeout: [transcript show: 'stop']
Comments
Post a Comment