Is this file locked?

Is there an easy ruby way to tell if a file is locked? I can lock a
file using File.flock, but I have a file which may have a shared lock
and I don’t want to mess with it unless no one else is locking it (and
grabbing an exclusive lock screws up the program that’s creating the

I’m on WinXP, so a solution using WIN32API would be acceptable.