Skip to content

Commit

Permalink
HidController: improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Oct 1, 2020
1 parent 447a432 commit 8e7e402
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/hid/hidcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ int HidController::close() {
bool HidController::poll() {
Trace hidRead("HidController poll");

int result = 1;
// This loop risks becoming a high priority endless loop in case processing
// the mapping JS code takes longer than the controller polling rate.
// This could stall other low priority tasks.
// There is no safety net for this because it has not been demonstrated to be
// a problem in practice.
int result = 1; // arbitrary value > 0 to start the loop
while (result > 0) {
// Rotate between two buffers so the memcmp below does not require deep copying to another buffer.
// Cycle between buffers so the memcmp below does not require deep copying to another buffer.
unsigned char* pPreviousBuffer = m_pPollData[m_iPollingBufferIndex];
m_iPollingBufferIndex = (m_iPollingBufferIndex + 1) % kNumBuffers;
unsigned char* pCurrentBuffer = m_pPollData[m_iPollingBufferIndex];
Expand Down

0 comments on commit 8e7e402

Please sign in to comment.