lock ()/releaselock () chain.
tests implemented.