zlacker

[return to "The Downsides of Go's Goroutines"]
1. keving+F7[view] [source] 2023-12-31 06:49:44
>>djha-s+(OP)
Externally canceling a task at a location other than a known stopping point is used as an example here, but in most environments doing this is a known-bad design decision, since the terminated thread-or-task might have been holding a mutex, and now that mutex is stuck closed forever. .NET has been closing the door on this primitive for years (https://learn.microsoft.com/en-us/dotnet/core/compatibility/...)
◧◩
2. djha-s+MB[view] [source] 2023-12-31 14:17:09
>>keving+F7
That mutex gets cleaned up because thread interruption is implemented as an exception, so the `finally` block would be able to take care of the mutex.
◧◩◪
3. keving+7t1[view] [source] 2023-12-31 21:02:23
>>djha-s+MB
this is only true if the mutex is guarded by a finally block. your thread could be calling anything, including user-space code written in C that holds a mutex.
[go to top]