avoid unnecessary declarations if ENABLE_THREADS is undefined

This reduces code size and compilation speed a bit.