Giter Club home page Giter Club logo

Comments (1)

daanx avatar daanx commented on June 16, 2024

Right, I will add documentation on this. The multi-prompt api is not doing any locking and leaves it up to the programmer.
It is generally not safe to resume a resumption from another thread for 2 reasons:

  1. like you observe, you may take mutex and yield up on thread A, and then resume it on thread B which subsequently releases the mutex. Now different threads access the mutex.
  2. also, you may start on threead A, and resume on thread B; now when B yields up it may be that that operation executes in a stack that originated on thread A but is now running the context of thread B. That may give trouble if there is a dependency on thread local state.

So, generally one must be very careful to migrate resumptions between threads. It is possible though in principle if the right guarantees are given, in particular if it is used from the outermost handler (for example, this would be the case for asynchronous I/O or a green-threading library)

from libmprompt.

Related Issues (6)

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.