It turns out the receiveTimeout technique didn't work well for me. In my case, there's a timer which spawns a high-priority thread calling `foo` several hundred times per second. What I really needed is to exhaust the message queue, and then do some other work after that. So I've added a `shared int messagesInQueue`, which gets incremented in the main thread, and decremented in the work thread when it reads off those messages.
But isn't something like this already implemented somewhere in core.thread or std.concurrency? All I want to do is check if there are /any/ messages in queue for the current thread.