Jump to content

April 2017 »

232425262728 29
- - - - -

Stage 1 Completed... Get Ready!

4: Adsense

After significant amounts of scouring across the intertron, and after pulling out large clumps of hair, I've managed to get lock-free message passing implemented in Epoch. This is cool because it makes it trivial to throw hundreds of messages around between tasks, and it's much more efficient than locking all the time.

Unfortunately, I have two problems:
  • The implementation is prone to the ABA problem. I have a minor suspicion that this won't actually bite me because of the way messages are tracked, but I'm way too brain-dead to prove it.

  • The implementation is of a LIFO stack. This means that the order of messages is not preserved; i.e. if I send a task the messages A,B,C,D, it may get them in any unpredictable order. I'd really prefer the semantics to be FIFO, so that if I send A,B,C,D then that's exactly the order the target thread reads the messages.

So I'm going to work on shifting towards a FIFO queue; I've got my eye on an implementation that promises to also solve the ABA problem, so that should be good.

All in all, this was actually less of a problem than I expected; I think I'll be done well before the Wednesday deadline. This is good, because the code needs a lot of polish before I'm really comfortable with releasing it at GDC.

Don't touch that remote - we'll be back shortly with yet more Gooey Chewy Epoch Goodness.

Note: GameDev.net moderates comments.