How do make my program runs several activities without multithreading?
- oopsLv 69 years agoFavorite Answer
Design the activities in such a way that they can run in slices, and run them in an infinite loop. In fact, pretty much any program that is designed to interact with users(GUI programs, video games, etc...) runs this way. For example, here's pseudo-code of a video game's main loop:
This loop runs hundreds or thousands of times per second, each function is only designed to do fractions of a second worth of work.
- PyrosLv 59 years ago
You can't really... if you're using .net framework then you can use the invoke method of system.threading.parallel class and .net will take care of the grunt work for you. If you want more control then look up a thread pool or a background worker. The invoke trick is done like so:
() => method1(arguments),
() => method2(arguments)
- David14Lv 79 years ago
You can't. That's like trying to drink from an empty glass.