Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Oct 17, 2023
1 parent b84ad52 commit 14f870c
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/utils/flock.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ async function flock(fd: number, op: 'un' | 'ex') {
const LOCKFILE_FAIL_IMMEDIATELY = 0x1;
const ZERO_OVERLAPPED = new ArrayBuffer(20); // Create a zeroed-out OVERLAPPED structure

const cLockFileEx = libc.func('LockFileEx', 'BOOL', [
'HANDLE', // hFile
'DWORD', // dwFlags
'DWORD', // dwReserved
'DWORD', // nNumberOfBytesToLockLow
'DWORD', // nNumberOfBytesToLockHigh
'LPOVERLAPPED' // lpOverlapped
]);
const cLockFileEx = libc.func('BOOL LockFileEx(HANDLE, DWORD, DWORD, DWORD, DWORD, LPOVERLAPPED)');
await Deno.fdatasync(fd); // This ensures the handle is valid and ready

const hFile = fd; // In reality, you need to convert fd to a HANDLE. This is a placeholder.
Expand Down

0 comments on commit 14f870c

Please sign in to comment.