trying to get the exclusive lock logic in place
This commit is contained in:
parent
e57f5d29d9
commit
fa5cb557ba
|
@ -144,8 +144,8 @@
|
||||||
var oldVal = MACHINE.v;
|
var oldVal = MACHINE.v;
|
||||||
var oldArgcount = MACHINE.a;
|
var oldArgcount = MACHINE.a;
|
||||||
var oldProc = MACHINE.p;
|
var oldProc = MACHINE.p;
|
||||||
|
|
||||||
var oldErrorHandler = MACHINE.params['currentErrorHandler'];
|
var oldErrorHandler = MACHINE.params['currentErrorHandler'];
|
||||||
|
|
||||||
var afterGoodInvoke = function (MACHINE) {
|
var afterGoodInvoke = function (MACHINE) {
|
||||||
plt.runtime.PAUSE(
|
plt.runtime.PAUSE(
|
||||||
function (restart) {
|
function (restart) {
|
||||||
|
@ -186,8 +186,15 @@
|
||||||
MACHINE.a = oldArgcount;
|
MACHINE.a = oldArgcount;
|
||||||
MACHINE.p = oldProc;
|
MACHINE.p = oldProc;
|
||||||
fail(e);
|
fail(e);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MACHINE.exclusiveLock.acquire(
|
||||||
|
"js-as-closure",
|
||||||
|
function(releaseLock) {
|
||||||
|
releaseLock();
|
||||||
MACHINE.trampoline(v.label);
|
MACHINE.trampoline(v.label);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return f;
|
return f;
|
||||||
};
|
};
|
||||||
|
@ -270,6 +277,7 @@
|
||||||
MACHINE.p = oldProc;
|
MACHINE.p = oldProc;
|
||||||
fail(e);
|
fail(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
MACHINE.trampoline(proc.label);
|
MACHINE.trampoline(proc.label);
|
||||||
} else {
|
} else {
|
||||||
fail(baselib.exceptions.makeExnFail(
|
fail(baselib.exceptions.makeExnFail(
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
this.locked = id;
|
this.locked = id;
|
||||||
onAcquire.call(
|
onAcquire.call(
|
||||||
this,
|
this,
|
||||||
// NOTE: the caller must release the lock or else deadlock.
|
// NOTE: the caller must release the lock or else deadlock!
|
||||||
function() {
|
function() {
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function() {
|
function() {
|
||||||
|
@ -441,13 +441,16 @@
|
||||||
var recomputeMaxNumBouncesBeforeYield;
|
var recomputeMaxNumBouncesBeforeYield;
|
||||||
|
|
||||||
var scheduleTrampoline = function(MACHINE, f) {
|
var scheduleTrampoline = function(MACHINE, f) {
|
||||||
|
MACHINE.exclusiveLock.acquire(
|
||||||
|
'scheduleTrampoline',
|
||||||
|
function(release) {
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function() {
|
function() {
|
||||||
|
release();
|
||||||
// FIXME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
return MACHINE.trampoline(f);
|
return MACHINE.trampoline(f);
|
||||||
},
|
},
|
||||||
0);
|
0);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates a restarting function, that reschedules f in a context
|
// Creates a restarting function, that reschedules f in a context
|
||||||
|
@ -486,7 +489,7 @@
|
||||||
// Make sure to get an exclusive lock before jumping into trampoline.
|
// Make sure to get an exclusive lock before jumping into trampoline.
|
||||||
// Otherwise, Bad Things will happen.
|
// Otherwise, Bad Things will happen.
|
||||||
//
|
//
|
||||||
// e.g. machine.lock.acquire(function() { machine.trampoline... machine.lock.release();});
|
// e.g. machine.lock.acquire('id', function(release) { machine.trampoline... release();});
|
||||||
|
|
||||||
Machine.prototype.trampoline = function(initialJump, noJumpingOff) {
|
Machine.prototype.trampoline = function(initialJump, noJumpingOff) {
|
||||||
var thunk = initialJump;
|
var thunk = initialJump;
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
(provide version)
|
(provide version)
|
||||||
(: version String)
|
(: version String)
|
||||||
|
|
||||||
(define version "1.96")
|
(define version "1.97")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user