Quick Answer
What you are asking for is the core functionality in RCS and CVS; These revision control systems provide for write-locks on files (although the locks are breakable) so that no one else can commit if one user has a file checked out for writing.
IMHO
Having said that, it's a cumbersome and a rather horrible way to do collaborative development. It unnecessarily serializes processes that can otherwise be run in parallel. For example, if you and I are collaborating, and you are adding a new feature to the software in the same module (using same file), whereas I find a bug in the current version that I need to fix in order to continue work on the release branch, the forced lock will NOT work.
You really should look at the consequences of hard enforcement of write-locked files; you will end up creating MORE problems in the environment in the long run. This is coming from over 20 years of experience in managing large software development projects. I would humbly suggest that you give GIT, SVN or BZR a very serious and thorough study before you chose the archaic approaches of RCS or CVS.