Pseudo threads

Hello!
Please tell me how to emulate the work of multi-threaded mode in one thread.
Are they suitable for this Coroutine?
OR https://en.cppreference.com/w/cpp/thread/async?
Last edited on
Why can't you use threads?

The alternatives you mention can be made to work kind of like threads, but it won't be exactly the same (even ignoring performance differences). To answer your question we'd need to know what you need exactly.

If you need something that works exactly like threads but without using threads, the closest alternative is to use separate processes. Passing around requests and results becomes a bit of a pain, though.
Last edited on
For Windows, you could use fibres. You can have multiple fibres within one thread - but you have to manually schedule the fibres to run. See https://docs.microsoft.com/en-us/windows/win32/procthread/fibers
Topic archived. No new replies allowed.