MCPcopy Create free account
hub / github.com/bumptop/BumpTop / tryLock

Method tryLock

trunk/win/Source/BT_DesktopLock.cpp:31–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31bool DesktopLock::tryLock()
32{
33 if (isLocked())
34 return true;
35
36 lockFileHandle = CreateFile((LPCTSTR) native(QFileInfo(winOS->GetUserLocalApplicationDataPath(), QString(lockFileName))).utf16(),
37 GENERIC_READ | GENERIC_WRITE,
38 0, // don't share the file, this locks it
39 NULL,
40 OPEN_ALWAYS, // create the file if it doesn't exist
41 FILE_ATTRIBUTE_NORMAL,
42 NULL);
43
44
45
46
47 return isLocked();
48}
49void DesktopLock::unlock()
50{
51 if (lockFileHandle != INVALID_HANDLE_VALUE)

Callers 10

InitMethod · 0.45
SetWindowStateMethod · 0.45
QueryRecycleBinMethod · 0.45
updateMethod · 0.45
loadQueuedTextureMethod · 0.45
onTimerMethod · 0.45
getStateMethod · 0.45
testBasicMethod · 0.45
messageProcMethod · 0.45
relockMethod · 0.45

Calls 4

QFileInfoClass · 0.85
nativeFunction · 0.70
QStringFunction · 0.50

Tested by 1

testBasicMethod · 0.36