+    # announce the write lock
+    # and wait $timeout seconds for
+    # references == 0 (no shared locks set)
+    #
+    &simple_lock ($filename,$timeout) or return;
+    for (0..$timeout) {
+      # lock reference counter
+      # or fail
+      #
+      unless (&simple_lock (&reffile($filename),$timeout)) {
+        &simple_unlock($filename,$timeout);
+        return;
+      }
+
+      # ready if we have no shared locks
+      #