Do not use tight timeouts for empty queues

Using a tight (0ms) timeout in take-message leads to 100% CPU load in
the browser.  Instead, record the processing functions in the queue
state and start them as soon as the queue becomes non-empty (due to
put-message).