Code Monkey home page Code Monkey logo

Comments (5)

emaxerrno avatar emaxerrno commented on May 22, 2024

@varunsharmagit you may have to do something along the lines of

callback->getEventBase() -> runInEventBaseThread ([](){ /* your code */ });

type of thing. I successfully dispatch execption() but that's how you can dispatach callbacks from differen threads that need the eventloop.

at least from reading the source that's what I can tell.

in fact reading the source, that's exactly what the lib does for example

  void exceptionInThread(folly::exception_wrapper ew) {
    getEventBase()->runInEventBaseThread([=](){
        this->exception(ew);
        delete this;
      });

from fbthrift.

varunsharmagit avatar varunsharmagit commented on May 22, 2024

Yeah, we figured this out eventually. The following worked:

callback.release()->exceptionInThread(ex);

The release() is needed since the exceptionInThread deletes the original callback which is otherwise held inside a unique_ptr.

from fbthrift.

emaxerrno avatar emaxerrno commented on May 22, 2024

@varunsharmagit cool, good to know!

from fbthrift.

djwatson avatar djwatson commented on May 22, 2024

Yep, you guys got it. result() was refactored at some point to automatically call runInEventBaseThread, but maybe exception() still doesn't.

from fbthrift.

alandau avatar alandau commented on May 22, 2024

Fixed internally, will be available on github at the next push.

from fbthrift.

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.