Add cross core wait mechanism, use it for futures and ports. Also overhaul work and idle task code.