Fixed build errors in release mode related to the switch to threadnum_t.