Added Pthread Locks To HTTP Writes

It was possible to have two separate threads do an HTTP write at
the same time if a user is doing an HTTP flush. Added a pthread
mutex to the CTX structure which locks whenever we try to do an
HTTP write to ensure that we never have two separate threads
attempting to write out at the same time.