jdonaldson/promhx — pull request #41 by vizanto (2014-11-05 12:15:09+00:00)
Title: Use peekLast, as peek can return null while the queue still has items.

Turns out `java.vm.AtomicList.peek()` is not safe/useful at all.
Should probably report a bug. `peekLast` will work.

AtomicList is implemented with 2 pointers `head` and `tail`. Don't know why the implementor thought this would work without locking .. you can only CAS one value at a time.
So while items are removed from head, tail still has data.

Discovered this while testing a bunch of promises in a simple single threaded loop:
```haxe
promhx.base.EventLoop.nextLoop = function(_) {};
// create a bunch of promises...
while (!promhx.base.EventLoop.queueEmpty()){
promhx.base.EventLoop.f();
}
```