Giter Site home page Giter Site logo

Comments (4)

gepz avatar gepz commented on June 1, 2024 1

I see, thanks for the info.

from kstatemachine.

nsk90 avatar nsk90 commented on June 1, 2024

I think the reason is that scope created here suspend fun makeM() = coroutineScope { and used in state machine here createStateMachine(this) is already cancelled when you call m.exportToPlantUml().

Check this version, please.

from kstatemachine.

gepz avatar gepz commented on June 1, 2024

Does the scope used by the factory function have to exist throughout the entire life time of the state machine?
If so, how can I save the machine as a variable?

from kstatemachine.

nsk90 avatar nsk90 commented on June 1, 2024

Yes life time of a scope should be equal or longer then machine lifetime. There is no problem with storing machine as variable. Just create your couroutine scope or use standard one (like GlobalScope). The reason of your problem is that you are using coroutineScope function which is not designed for scope creation, but for parallel decomposition of work.

https://kt.academy/article/cc-constructing-scope here you can find samples of scope creation that I mean.

Actually to call coroutineScope you already need to have a scope, you have created it by runTest block in your sample.

from kstatemachine.

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.