Added spin lock into mthread.c