39#include "blocxx/BLOCXX_config.h"
51 #ifdef BLOCXX_HAVE_UNISTD_H
96 DuplicateHandle(GetCurrentProcess(), x.m_hdl, GetCurrentProcess(),
97 &m_hdl , 0, FALSE, DUPLICATE_SAME_ACCESS);
102File::getLock(ELockType type)
104 return doLock(m_hdl,
true, type == E_WRITE_LOCK ?
105 LOCKFILE_EXCLUSIVE_LOCK : 0);
109File::tryLock(ELockType type)
111 return doLock(m_hdl,
false, type == E_WRITE_LOCK ?
112 LOCKFILE_EXCLUSIVE_LOCK : 0);
118 if (m_hdl == INVALID_HANDLE_VALUE)
124 memset(&ov, 0,
sizeof(ov));
125 if (!UnlockFileEx(m_hdl, 0, 0xffffffff, 0xffffffff, &ov))
154 return ::fcntl(hdl,
cmd, &
lck);
187 Format(
"Closing file handle %1 failed: %2",
#define BLOCXX_LOG_ERROR(logger, message)
Log message to logger with the Error level.
#define BLOCXX_INVALID_FILEHANDLE
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
int unlock()
Release a lock on the file.
int tryLock(ELockType type=E_WRITE_LOCK)
Acquire a kernel lock on the file.
int close()
Close the underlying file object.
int getLock(ELockType type=E_WRITE_LOCK)
Acquire a kernel lock on the file.
bool operator==(const File &rhs)
Equality operator.
@ E_WRITE_LOCK
Flag to place an write / exclusive lock.
File()
Create a NULL File object.
bool operator==(const Array< T > &x, const Array< T > &y)