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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

leo-vernisse
Copy link
Member

No description provided.

@leo-vernisse leo-vernisse 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

@leo-vernisse leo-vernisse requested a review from fafhrd91 January 22, 2025 09:09
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