Add pipelining support to locking functions.

No, I'm not gonna compile this mess until I finish the rest of IPC.
Now that I think about it, that might have been a bad idea.