Timeout around function call

drathier forum.dlang.org at fi.fo
Sun Sep 27 19:02:00 UTC 2020


On Wednesday, 23 September 2020 at 20:58:00 UTC, Imperatorn wrote:
> On Wednesday, 23 September 2020 at 20:54:51 UTC, Imperatorn 
> wrote:
>> On Wednesday, 23 September 2020 at 20:44:51 UTC, Ali Çehreli 
>> wrote:
>>> On 9/23/20 1:19 PM, Imperatorn wrote:
>>>
>>> > [...]
>>> send a
>>> > [...]
>>> with timeout.
>>>
>>> [...]
>>
>> Sorry, I can't see the problem. Could you be more specific 
>> about what you want to achieve?
>
> Oops, I meant to reply to drathier

I need to:

- call a side-effect-free fn with a huge argument that I don't 
want to copy; this argument is then returned mostly unmodified 
wrapped in a new value
- stop executing it if it runs for more than x seconds
- get the return value from it if it finishes within x seconds 
(99.9% of time time)
- let the main thread know what happened
- the main thread should block until the fn call returns
- the fn call should for sure stop executing before the main 
thread carries on
- the size and complexity of the fn makes it pretty much 
impossible to add timeout checks everywhere to make it exit 
nicely; I need to kill it to be sure I didn't miss a case





More information about the Digitalmars-d-learn mailing list