Change msg_queue_events template to have callback arg as template arg.

This change enables more precise control over how callbacks are handled.
Change mq_ptr to use new callback system.
Create generic workq callback mechanism.
Make promise wait() not use busy-waiting.