add "collector" callbacks for idle threads

Details in the header docs.

Tested this by adding a collector to examples/echo and observing it
get called every 5 seconds for the scheduler thread and dns threads.

If I connect to the echo server and interact with it, the collector
for the scheduler thread is delayed by my interaction before resuming
every 5 seconds.