use a real scheduler for most main loop scheduling

 * should behave similiar to old version
 * add min ap stat to commands (incomplete)
compilation fixes for newer compilers
remove fake non-block functions

 * those functions were blocking
 * potentially block longer than the blocking version
 * they could fail and noone checked for failure