Avoiding pthreads because they aren't portable and replacing them with a spinlock sounds a little bit like madness, that was my point.
What is the non-posix target you have in mind? Windows? Seems like conditionally compiling against either pthreads or win32 critical section [or anything else] is a feasible thing and reasonable action. Maybe even the spinlock as a last resort.