Dev commit

Add atomic operation for setting writing flag. When one thread wants to write, it will
call Check_and_set_writing() to see if someone is already writing. If yes, it will
sleep and retry after 20ms. If not, by calling check_and_set_writing , this thread
is safe to write. The writing flag will be cleared when everything on mp_wbuf have
been written to socket.