Warning: session_start(): open(/var/lib/php/sessions/sess_fummadrjcvjmk84pdudsptj556, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
static Lock a = fairLock();
static Lock b = fairLock();
p-tt {
centerHigherConsole();
doEvery_daemon(1000, r {
L lockingThreads = printDeadlocks();
if (nempty(lockingThreads)) {
print("Interrupting locking threads.");
L threads = threadInfosToThreads(lockingThreads);
if (nempty(threads)) {
Thread t = random(threads);
print("Interrupting thread " + quote(t.getName()));
t.interrupt();
}
}
});
print("Initiating deadlock... :-)\n");
thread "A" {
lock(a);
try {
print("Thread A has lock A.");
sleep1Second();
print("Thread A getting lock B.");
lock(b);
try {
print("Thread A successful!");
} finally {
b.unlock();
}
} finally {
a.unlock();
}
}
thread "B" {
lock(b);
try {
print("Thread B has lock B.");
sleep1Second();
print("Thread B getting lock A.");
lock(a);
try {
print("Thread B successful!");
} finally {
a.unlock();
}
} finally {
b.unlock();
}
}
sleepQuietly();
}