Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 851
    • Issues 851
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 45
    • Merge requests 45
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !2769

gthread: Introduce GAtomicLock and GAtomicRecLock spin-lock

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Marco Trevisan requested to merge 3v1n0/glib:atomic-spin-locks into main Jun 23, 2022
  • Overview 7
  • Commits 1
  • Pipelines 1
  • Changes 8

Locks can be implemented by using native OS mutexes or can relying on CPU features to only use atomic operations to enter in critical areas.

While GMutex has an internal implementation that uses this, it's not exposed as public API and it has some complications as it's also meant to be used with GCond's.

We can instead expose a public API that is guaranteed to only use atomic logic, at least when G_ATOMIC_LOCK_FREE is defined.


Note: I actually noticed that our posix locks were using a similar concept, in various build scenarios before doing !2768 (closed), but I think it may still be relevant to have a generic API that can be used explicitly.

Otherwise, we can just ignore this. But since I had it already ready before going into the deep, I decided to submit it anyways 😄, so that I could use it for !2765

Edited Jun 23, 2022 by Marco Trevisan
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: atomic-spin-locks