thanks I would really like to have some solid basis for such kind of issue in pharo. Stef On Oct 16, 2010, at 8:20 AM, Igor Stasenko wrote:
Hello,
as a result of recently happened discussion about atomic operations, i implemented two kinds of thread-safe queues FIFO and LIFO, which using atomic operations, instead of semaphore to add/remove items.
You may review it by loading the code from SqueakSource:
MCHttpRepository location: 'http://www.squeaksource.com/Atomics' user: '' password: ''
FIFOQueue scales much better than SharedQueue, and after some additional testing can fully replace it.
I tested FIFOQueue by replacing a SharedQueue class for EventSensor (a core system part, responsible for delivering events). In attached file you can find a patch, which will make your sensor to work with FIFOQueue, after you save image, or do 'EventSensor install'.
There are also a heavy-concurrency tests in corresponding test classes, which is passing ok.
Concurrency is highly complex field, thus i won't be surprised if code still contains a bugs.
Code license is MIT, moreover a repository is publicly writeable, so if you wanna add tests, benchmarks, fixes, or implement new kind of lock-free container, feel free to do it.
Any feedback is welcome.
-- Best regards, Igor Stasenko AKA sig. <sensor-queue-patch.1.cs>