Put previously removed ifdef back, and add some comments with the reason why. Also clarify the situation with "C const func" in thread.h with a few comments.