Issue #554 resolved

Channel race condition and other issues

created an issue
  1. Channel::clear does not broadcast and reset counters

    After popping everything from the queue, Channel::clear does not broadcast for the threads waiting in Channel::supply. It should also reset the sent and received variables (setting received equal to sent is one solution).

  2. Channel::demand and Channel::supply may miss a broadcast and get stuck

    The mutex for the condition variable gets locked inside the loop of Channel::demand and after push in Channel::supply. There's a possibility a broadcast is missed if the function is outside of those locks. The mutex should be locked over loop and including push to ensure that every change to the queue is processed.

  3. Channel wrapper uses Variant::release outside of locks

    The reference counting of Variant needs to stay thread safe or LÖVE may try to execute deallocated memory or call delete on the same pointer twice.

  4. Parts of the thread module do not conform to the Code Style

    I see problems with the indentation, pointer and reference identifier/operator position, and initializer lists.

Edit: Fixed Channel::supply problem description and link.

Comments (2)

  1. Log in to comment