Monitor.Enter and hardware interaction

I recently discovered the issue with accessing the same hardware from different threads and the issues it can cause like freezing the hardware.

What is the best practice to avoid this conflict? I currently use monitor.enter…exit at a functional level instead of at a lower level.

eg im using the MUX MCP23017

//High Level Usage
function turnONLED()
{
Monitor.Enter(A)
...
ReadPin(PGB01);

Write(PGB01,true);
...
Monitor.Exit()
}



or should i put the monitor.enter.exit at the lower level ie ReadPin and Write functions.

Is Monitor.Enter…Exit resource intensive? Or the liberal use of it ok?