dummy_main: use scope_exit to turn off scheduler.
dummy_main: use scope_exit to turn off scheduler.

The worker threads need to be stopped before we return from main to
prevent using the ports/connectables while they are being destroyed.
Once the worker threads are stopped, ports/nodes can be destroyed, and
then the scheduler itself can be destroyed.

Scope_exit is less error-prone than having to stop the scheduler
manually on every exit path.

CasparKielwein/flexcore,FlexCoreLib/flexcore