8 ms·
In a cooperative multi-threaded model you can only have data-races at function-call boundaries. For example: `x+=1` can never data-race.
by aidenn0 9y ago
In a cooperative multi-threaded model you can only have data-races at function-call boundaries. For example: `x+=1` can never data-race.
- ngrilly 9y agoExcept if your programming language allows you to override the += operator.
- aidenn0 9y agoYou are proposing a situation where someone overrides += to specifically both call a blocking function and to not make it work correctly. I'm not saying it doesn't happen, but bad code is bad code regardless of your paradigm. Though I must admit I've not done cooperative multitasking in a language with operator overloading so I can't say whether or not this is a problem in practice.
- ngrilly 9y agoIn can happen for example in Python with gevent.