Its one of the reasons that several reasonable developers in many languages have suggested using independent “tasks” (essentially processes) instead - they are easier to manage & to debug and the shared state issues you can run into with threads simply don’t exist.
If you need high speed data transfers IPC is not bad.
Shared memory can be way faster but harder to set up - and you may have some of the same shared state issues as threads.
And with separate processes IF you used IPC its not that bad to switch to TCP and now have helpers running on separate machines - something that you can’t do with threads in a reasonable fashion.
[quote=63230:@Amando Blasco]and yes, I have pulled my hair, destroyed a few keyboards, etc… but once the code doesn’t deadlock it’s worth every keyboard (I used cheap ones when dealing with this kind of coding).
[/quote]
Likewise - I used to have hair but now look at my avatar
I wouldn’t try to emulate threading in a single process
You will just get frustrated
But stand alone processes that the OS switches between you probably won’t have this same issue