Moved pthread mutex inits up, due to applog using a mutex causing a crash. Added Win32 compatability to opt.c.