 
 import Foundation
 import TSCLibc
+
+public enum LockType {
+    case exclusive
+    case shared
+}
 
 /// A simple lock wrapper.
 public struct Lock {

    }

    /// Execute the given block while holding the lock.
    public func withLock<T>(_ body: () throws -> T) throws -> T {
        try lock()
        defer { unlock() }
        return try body()
    }

        }
        // Aquire lock on the file.
        while true {
            if type == .exclusive && flock(fileDescriptor!, LOCK_EX) == 0 {
                break
            } else if type == .shared && flock(fileDescriptor!, LOCK_SH) == 0 {
                break
            }
            // Retry if interrupted.
