Skip to content

[POC] Add message-available callback to CommandQueue#84

Draft
mfazekas wants to merge 1 commit intorive-app:mainfrom
mfazekas:mfazekas/message-available-callback
Draft

[POC] Add message-available callback to CommandQueue#84
mfazekas wants to merge 1 commit intorive-app:mainfrom
mfazekas:mfazekas/message-available-callback

Conversation

@mfazekas
Copy link

@mfazekas mfazekas commented Feb 13, 2026

POC — looking for feedback, not intended to merge as-is.

Adds setMessageAvailableCallback() to CommandQueue so the server can notify the client immediately when response messages are written, instead of waiting for the next render loop poll. This is the symmetric counterpart to m_commandConditionVariable.notify_one() that already exists for client→server.

Intended use: iOS runtime would use this to dispatch_async a processMessages() call, eliminating up to 1 frame of latency on async reads.

  _commandQueue->setMessageAvailableCallback([self]() {
      // Server thread just wrote messages — wake the main thread to process them
      dispatch_async(dispatch_get_main_queue(), ^{
          [self processMessages];
      });
  });

Add setMessageAvailableCallback() to CommandQueue so the server can
notify the client immediately when response messages are available,
instead of relying on polling via processMessages() on the render loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant