Skip to content

Can I send a SUBSCRIBE command using a context that's blocked on redisGetReply #1078

Discussion options

You must be logged in to vote

Hi, thanks for the question.

Although this may work sometimes, it will inevitably lead to undefined behavior and fail in strange and difficult-to-predict ways.

The reason for this is that two independent threads will be attempting to operate on the same shared internal context and hiredis does not do any synchronization internally.

The async API can do what you need, and we actually recently merged a polling adapter, which would allow you to use it without having to add an event library to your application.

The adapter in question
An example program that uses it

Another solution could possibly be to PUBLISH a message to the blocked client with some kind of special payload that would infor…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by peter-lee-schneider
Comment options

You must be logged in to vote
0 replies
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