Comment #10 on issue 3498 by stephane.ducasse: remove:ifAbsent: in linked list leads to interruption/sync problems
http://code.google.com/p/pharo/issues/detail?id=3498

adrian: I'll try that...
But I still don't understand why the change in Pharo that makes LinkedList>>remove:ifAbsent: non thread safe can cause the problem since this code is executed by the timerEvent process, which runs at the highest priority. This process should never be suspended during the execution of remove:ifAbsent:. What do I miss?

Andreas: The problem isn't thread-safety, at least in the classical definition. What happens is that if you're removing processes by using LinkedList>>remove: you are subject to a race condition where the semaphore gets signaled *while* you are removing the the process. Obviously, hillarity ensues at this point, which is why I made primitive suspend do the Right Thing (i.e., remove the process primitively). There are two parameters which affect if you're likely to see the effect or not: One is the number of suspension points (real sends) in the method. The more you have, the more likely you're affected. The second one is whether the method can tolerate having the process removed "underneith its feet". Both are far worse in Pharo.


Reply via email to