Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make keymap thread-safe #540

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wismill
Copy link
Member

@wismill wismill commented Nov 19, 2024

(WIP, to open discussion)

The only value that can be modified, once the keymap is compiled, is the reference counter. Use atomics to make it thread-safe.

WARNING: this alone does not make the keymap API thread-safe:

  1. It depends on the atom table in the xkb_context for its strings values; this table is not thread-safe.
    However it is “safe” only if no other keymap is compiled using the same context.
  2. Functions retrieving text may use the xkb_context internal string buffer, which is not thread safe.
    API not using this buffer should be “safe”.
  3. Functions use the xkb_context log function, but modifying it is not thread-safe.
  4. State API is not thread-safe.

Fixes #300

The only value that can be modified, once the keymap is compiled, is the
reference counter. Use atomics to make it thread-safe.

WARNING: this alone does not make the keymap API thread-safe:
- It depends on the atom table in the `xkb_context` for its strings
  values; this table is not thread-safe.
- Functions retrieving text may use the `xkb_context` internal string
  buffer, which is not thread safe.
@wismill wismill mentioned this pull request Nov 19, 2024
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.

Thread safety
1 participant