Pios sync primitives

* fixes #1113 
* fixes #1114 
* fixes #1115 
* takes next step in abstracting os api by adding pios_mutex
Just so I follow, in situations like this how did you determine it didn't need to be recursive? Inspection? Were we using that primitive too freely?