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

[6.0]support coroutine lock feature #5554

Closed

Conversation

NathanFreeman
Copy link
Member

No description provided.

@NathanFreeman NathanFreeman changed the title [6.0]support coroutine feature [6.0]support coroutine lock feature Nov 3, 2024
Copy link

codecov bot commented Nov 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 45 lines in your changes missing coverage. Please review.

Project coverage is 70.65%. Comparing base (050293e) to head (4b14d59).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/lock/coroutine_lock.cc 0.00% 45 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5554      +/-   ##
==========================================
- Coverage   70.84%   70.65%   -0.20%     
==========================================
  Files         108      109       +1     
  Lines       16720    16764      +44     
  Branches     3057     3064       +7     
==========================================
- Hits        11846    11844       -2     
- Misses       4818     4864      +46     
  Partials       56       56              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NathanFreeman NathanFreeman force-pushed the coroutine_lock_feature branch 6 times, most recently from 5f20841 to e63515b Compare November 6, 2024 02:25
include/swoole_lock.h Show resolved Hide resolved
@@ -54,6 +58,9 @@ struct IouringEvent {
const char *pathname;
const char *pathname2;
struct statx *statxbuf;
#ifdef HAVE_IOURING_FUTEX
uint32_t *futex;
Copy link
Member

Choose a reason for hiding this comment

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

Can be unioned with other fields to save memory

#ifdef HAVE_IOURING_FUTEX
case SW_IORING_OP_FUTEX_WAIT:
case SW_IORING_OP_FUTEX_WAKE:
return "FUTEX";
Copy link
Member

Choose a reason for hiding this comment

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

Should be displayed separately

Coroutine *current_coroutine = Coroutine::get_current();
if (current_coroutine == nullptr) {
swoole_warning("The coroutine lock can only be used in a coroutine environment");
return 1;
Copy link
Member

Choose a reason for hiding this comment

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

Should return an error code

return 1;
}

result = Iouring::futex_wait((uint32_t *) value);
Copy link
Member

Choose a reason for hiding this comment

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

No check result is given. If the wait fails, it means that the lock ownership is not obtained.

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.

2 participants