summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSDistributedLock.java
blob: 61fe5894a3e4d5c2ff7cc72eb3a27c648241e821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.eclipse.swt.internal.cocoa;

public class NSDistributedLock extends NSObject {

public NSDistributedLock() {
	super();
}

public NSDistributedLock(int id) {
	super(id);
}

public void breakLock() {
	OS.objc_msgSend(this.id, OS.sel_breakLock);
}

public id initWithPath(NSString path) {
	int result = OS.objc_msgSend(this.id, OS.sel_initWithPath_1, path != null ? path.id : 0);
	return result != 0 ? new id(result) : null;
}

public NSDate lockDate() {
	int result = OS.objc_msgSend(this.id, OS.sel_lockDate);
	return result != 0 ? new NSDate(result) : null;
}

public static NSDistributedLock lockWithPath(NSString path) {
	int result = OS.objc_msgSend(OS.class_NSDistributedLock, OS.sel_lockWithPath_1, path != null ? path.id : 0);
	return result != 0 ? new NSDistributedLock(result) : null;
}

public boolean tryLock() {
	return OS.objc_msgSend(this.id, OS.sel_tryLock) != 0;
}

public void unlock() {
	OS.objc_msgSend(this.id, OS.sel_unlock);
}

}