abstract threading a bit using pthreads api.

has some basics for win32 threading. not super great though.