NosotrosNueces/mcc — pull request #41 by amlweems (2014-10-19 04:45:47+00:00)
Title: Reworked threading model

Each bot now runs three threads: a receiver, an event handler, and a main thread.

## Receiver ##
Continuously polls the bot's sockfd until it is ready for reading. When the socket is ready, this thread reads an entire packet and places it in a FIFO shared with the event handler thread. Because each bot has it's own receiver, reading a large packet in one bot does not block other bots.

## Event Handler ##
Continuously pops elements from the shared FIFO (a blocking call). For each element, we peek at the packet ID and call all the associated event handlers. To achieve this, modifications had to be made to the way `callback_decode` worked, so it was renamed to `protocol_decode` to emphasize new functionality (returning data rather than calling the callbacks).

## Bot Main ##
Essentially the same as before but without any signals. This PR does not implement threadsafe operations on bot_t. In the future, `sample_bot.c` and `bot.c` should be updated to use mutexes.