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

fix/example: shared mutable state #13

Merged
merged 3 commits into from
Feb 2, 2025
Merged

Conversation

leon3s
Copy link
Member

@leon3s leon3s commented Jan 20, 2025

No description provided.

@leon3s leon3s requested a review from fafhrd91 January 20, 2025 08:02
@@ -1,6 +1,6 @@
// <setup_mutable>
use ntex::web;
use std::sync::Mutex;
use std::sync::{Arc, Mutex};

struct AppStateWithCounter {
counter: Mutex<i32>, // <- Mutex is necessary to mutate safely across threads
Copy link
Member

Choose a reason for hiding this comment

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

You have to use Arc<Mutex<_>> here, or Arc for index handler

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad i fixed it, and let's see if i fixed the ci build aswell

@leon3s leon3s requested a review from fafhrd91 January 22, 2025 09:09
@leon3s
Copy link
Member Author

leon3s commented Feb 2, 2025

@fafhrd91 do we merge or you fixed it in another way?

@fafhrd91
Copy link
Member

fafhrd91 commented Feb 2, 2025

i thought this was merged already

@leon3s leon3s merged commit 7a0d627 into master Feb 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants