Timeout around function call

Imperatorn johan_forsberg_86 at hotmail.com
Wed Sep 23 20:19:58 UTC 2020


On Wednesday, 23 September 2020 at 17:33:50 UTC, drathier wrote:
> On Tuesday, 22 September 2020 at 21:55:51 UTC, Imperatorn wrote:
>> [...]
>
> Blocking is perfectly fine. I'm wondering if I need things to 
> be shared now or something? Not used to programming with 
> threads. Adding a shared modifier recursively onto every piece 
> of data that needs it is a ton of work though.
>
> I don't want to copy the data around since it's many gigabytes, 
> but I'm sure there won't be any data races; main thread will 
> start 2 threads, one for running the timer and one running the 
> function call. The main thread doesn't access the data until 
> both the timer and function call threads have stopped 
> completely.

No. You should not share anything. Personally I would just send a 
message to request termination or use the solution provided with 
timeout.


More information about the Digitalmars-d-learn mailing list