The only operation here which needs to be synchronized is the increment of the index
value. Since this is just a numeric value it can be done without the use of locks via an atomic increment. The rest of the operations you listed are just reads of a shared location and don't need to be synchronized.
On Win32 making the increment synchronized is done with the InterlockedIncrement
function
int oldValue = InterlockedIncrement(&index);
int val = memLoc[oldValue & 0xFF];
There are various synchronized increment functions available on Linux. There is a fairly good discussion about the options on this stackoverflow thread