Skip to content

Pubsub implementation not usable in hyper handler #271

Answered by Byron
bmoyet asked this question in Q&A
Discussion options

You must be logged in to vote

Indeed that's more of a Rust question, let's see if this can be sorted. Also I am happy the build is failing, which is one of the major benefits when using Rust (AKA fearless concurrency :D).

router.get("/test", ENDPOINT) wants to use ENDPOINT in a thread as part of its internal machinery and do so by reference, requiring the Future to be Sync. The RefCell used in its belly is not Sync though and can't be accessed by multiple threads safely without a race condition: after all it wants to assure that using the same thing mutably panics at runtime.

One way to solve this would be to make the APIs threadsafe, so instead of using a RefCell, one could use a Mutex. It's something I am happy to d…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@Byron
Comment options

@bmoyet
Comment options

@Byron
Comment options

@bmoyet
Comment options

@Byron
Comment options

Answer selected by bmoyet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #270 on April 13, 2021 11:03.