fix: timedwait may not support NULL timespec pointer; statement in assert() may not be calculated; condition mutex should be unlocked while canceling thread, etc.