Update mpi_to_openshmem.c

Added mutex for multiple threads.
Cleaned up some code.
Added a couple of comments.