Skip to content

Conversation

@AvarianKnight
Copy link
Contributor

Goal of this PR

Reduce locking around user list access

How is this PR achieving the goal

  • _isAnyoneTalking gets called a decent bit in game code, and for some reason the code here iterates the entire talker list again, and this can presumably happen multiple times a frame and cause lock contention. Most of the work here is already handled by another call that happens per frame so we just reuse g_talkers and o_talkers.

  • GetTalkers also did a bunch of un-needed locking on every GetUser call when it was trying to get users from their session id's, so we change how we expect data to be handed back down and add a new function to handle getting all of the user names and reduce the amount of locking/unlocking we do.

This PR applies to the following area(s)

FiveM/RedM

Successfully tested on

Game builds: ..

Platforms: Windows, Linux

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

- `_isAnyoneTalking` gets called a decent bit in game code, and for some
reason the code here iterates *the entire talker list* again, and this can
presummably happen multiple times a frame and cause lock contention. Most
of the work here is already handled by another call that happens per frame
so we juse reuse `g_talkers` and `o_talkers`.

- `GetTalkers` also did a bunch of un-needed locking on every `GetUser`
call when it was trying to get users from their session id's, so we change
how we expect data to be handed back down and add a new function to handle
getting all of the user names and reduce the amount of locking/unlocking
we do.
@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant