Giter Club home page Giter Club logo

Comments (7)

sewenew avatar sewenew commented on June 13, 2024 2

I've left a comment on stackoverflow, please check it:

Looks like you used the continuation feature with boost. In that case, you should install boost first, enable the boost future support with -DREDIS_PLUS_PLUS_ASYNC_FUTURE=boost, and link boost with your application. Check this for detail.

from redis-plus-plus.

sewenew avatar sewenew commented on June 13, 2024 1

from redis-plus-plus.

sewenew avatar sewenew commented on June 13, 2024 1

As an additional question, is using only redis++_static.lib the same as using redis++.lib and redis++.dll?

redis++_static_lib is static library, while others are dynamic library. You can use either. It depends on whether you want to link it statically or dynamically.

if I subscribe to a channel as a "Subscriber or AsyncSubscriber" and am receiving messages, is it okay to subscribe to the channel additionally in a separate thread?

Do you mean that you have two threads, both threads subscribe to the same channel with different Subscriber or AsyncSubscriber? Yes, you can do that safely. Since different subscribers are dependent objects and has nothing to do with each other.

Regards

from redis-plus-plus.

hardworker0012 avatar hardworker0012 commented on June 13, 2024

Thank you for your help.
I solved the problem, I didn't figure out where it was working, but there seems to be some command that determines which header to use, boost or std, and copies the file.
As a result, async_utils.h, which uses std::future, was overwritten at build time, so when I tried to use boost::future as the build output lib, I got a link error.

My solution was to override the file to always overwrite async_utils.h with the boost version.


As an additional question, is using only redis++_static.lib the same as using redis++.lib and redis++.dll?

Also, if I subscribe to a channel as a "Subscriber or AsyncSubscriber" and am receiving messages, is it okay to subscribe to the channel additionally in a separate thread? The reason I ask is that I've seen it work without any issues when I've done it, but I'm wondering if this is the correct way to use it.

Redis++ is a great library that I really enjoy using. I really appreciate it.

Translated with www.DeepL.com/Translator (free version)

from redis-plus-plus.

hardworker0012 avatar hardworker0012 commented on June 13, 2024

I'm sorry. I think I may have misunderstood the meaning of my question, so let me rephrase it.

    ~MainThread
    {
        _AsyncSubscriber->on_meta([this](Subscriber::MsgType type, OptionalString OptionParamStr, long long num)
        _AsyncSubscriber->on_message([this](std::string channel, std::string msg)
        _AsyncSubscriber->on_pmessage([this](std::string pattern, std::string channel, std::string msg)
        ...
        _AsyncSubscriber->psubscribe(pattern); 
        
        **// Receiving a message from an IO Thread...**
        ...
        ...
        Make_SubThread()...
    }

    ~SubThread
    {
        _AsyncSubscriber->psubscribe(addedPattern)  // 
        _AsyncSubscriber->subscribe(addedChannel)  // 
    }

After creating the _AsyncSubscriber in the main thread and registering each callback as above. subscribe to the channel, and then while it's Receiving the message I'm wondering if it's ThreadSafe to subscribe to additional channels in a subthread?

from redis-plus-plus.

sewenew avatar sewenew commented on June 13, 2024

Yes, the code you given is thread-safe.

Regards

from redis-plus-plus.

hardworker0012 avatar hardworker0012 commented on June 13, 2024

Thank you for your helpful reply. May you always be happy. Thank you so much

from redis-plus-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.