 
 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()
    }

        overlapped.Offset = 0
        overlapped.OffsetHigh = 0
        overlapped.hEvent = nil
        switch mode {
        case .exclusive:
            if !LockFileEx(handle, DWORD(LOCKFILE_EXCLUSIVE_LOCK), 0,
                           DWORD(INT_MAX), DWORD(INT_MAX), &overlapped) {
                throw ProcessLockError.unableToAquireLock(errno: Int32(GetLastError()))
            }
        case .shared:
            if !LockFileEx(handle, 0, 0,
                           DWORD(INT_MAX), DWORD(INT_MAX), &overlapped) {
                throw ProcessLockError.unableToAquireLock(errno: Int32(GetLastError()))
            }
        }
      #else
        // Open the lock file.
