Fix missing __lock / __unlock.

This was noticed as srandom / random use those.

Fixes issue #2916.