New semaphore lock

Hi, I do not know if you need this, but I implemented a semaphore lock for the shmif bus. If there is anything wrong with it or my (first) pull request is ill-formatted, please let me know. Thanks! Martin