Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Use Mutex#owned? to correctly check if the Mutex is owned by the current Thread or Fiber #504

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

pirj
Copy link
Member

@pirj pirj commented Apr 28, 2021

In Ruby >= 3, Mutex are held per Fiber, not per Thread.

Fixes #501

This is a backport of #503 for RSpec 3

…ent Thread or Fiber

* In Ruby >= 3, Mutex are held per Fiber, not per Thread.
* Fixes #501
@pirj pirj self-assigned this Apr 28, 2021
@pirj pirj requested review from benoittgt and JonRowe April 28, 2021 22:06
@pirj
Copy link
Member Author

pirj commented Apr 28, 2021

Green on the first try!

Copy link
Member

@JonRowe JonRowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked the changelog for 4.0 but I've picked that across here.

@JonRowe JonRowe merged commit 4ad8392 into main Apr 29, 2021
@JonRowe JonRowe deleted the fix-reentrant-mutex-fiber-3.0 branch April 29, 2021 08:48
JonRowe added a commit that referenced this pull request Apr 29, 2021
Use Mutex#owned? to correctly check if the Mutex is owned by the current Thread or Fiber
@pirj
Copy link
Member Author

pirj commented Apr 29, 2021

Thanks, Jon!

yujinakayama pushed a commit to yujinakayama/rspec-monorepo that referenced this pull request Oct 6, 2021
…eentrant-mutex-fiber-3.0

Use Mutex#owned? to correctly check if the Mutex is owned by the current Thread or Fiber

---
This commit was imported from rspec/rspec-support@4ad8392.
yujinakayama pushed a commit to yujinakayama/rspec-monorepo that referenced this pull request Oct 6, 2021
…eentrant-mutex-fiber-3.0

Use Mutex#owned? to correctly check if the Mutex is owned by the current Thread or Fiber

---
This commit was imported from rspec/rspec-support@77269e4.
@ioquatix
Copy link

ioquatix commented Nov 6, 2021

Has this been released yet?

@ioquatix
Copy link

ioquatix commented Nov 6, 2021

Oh, was this released 3 days ago? I still seem to experience some hangs in some cases, so maybe I need to investigate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ThreadError: Attempt to unlock a mutex which is locked by another thread/fiber
4 participants