starting to do something
This commit is contained in:
parent
efb978b52f
commit
6904222c69
|
@ -128,6 +128,9 @@
|
||||||
|
|
||||||
var coerseClosureToJavaScript = function (v, MACHINE) {
|
var coerseClosureToJavaScript = function (v, MACHINE) {
|
||||||
var f = function (succ, fail) {
|
var f = function (succ, fail) {
|
||||||
|
MACHINE.exclusiveLock.acquire(
|
||||||
|
"js-as-closure",
|
||||||
|
function(releaseLock) {
|
||||||
succ = succ || function () {};
|
succ = succ || function () {};
|
||||||
fail = fail || function () {};
|
fail = fail || function () {};
|
||||||
|
|
||||||
|
@ -188,10 +191,6 @@
|
||||||
fail(e);
|
fail(e);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MACHINE.exclusiveLock.acquire(
|
|
||||||
"js-as-closure",
|
|
||||||
function(releaseLock) {
|
|
||||||
releaseLock();
|
releaseLock();
|
||||||
MACHINE.trampoline(v.label);
|
MACHINE.trampoline(v.label);
|
||||||
});
|
});
|
||||||
|
@ -223,6 +222,10 @@
|
||||||
// internallCallDuringPause: call a Racket procedure and get its results.
|
// internallCallDuringPause: call a Racket procedure and get its results.
|
||||||
// The use assumes the machine is in a running-but-paused state.
|
// The use assumes the machine is in a running-but-paused state.
|
||||||
var internalCallDuringPause = function (MACHINE, proc, success, fail) {
|
var internalCallDuringPause = function (MACHINE, proc, success, fail) {
|
||||||
|
MACHINE.exclusiveLock.acquire(
|
||||||
|
"internal call during pause",
|
||||||
|
function(releaseLock) {
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
var oldArgcount, oldVal, oldProc, oldErrorHandler;
|
var oldArgcount, oldVal, oldProc, oldErrorHandler;
|
||||||
if (! baselib.arity.isArityMatching(proc.racketArity, arguments.length - 4)) {
|
if (! baselib.arity.isArityMatching(proc.racketArity, arguments.length - 4)) {
|
||||||
|
@ -278,7 +281,9 @@
|
||||||
fail(e);
|
fail(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
releaseLock();
|
||||||
MACHINE.trampoline(proc.label);
|
MACHINE.trampoline(proc.label);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fail(baselib.exceptions.makeExnFail(
|
fail(baselib.exceptions.makeExnFail(
|
||||||
baselib.format.format(
|
baselib.format.format(
|
||||||
|
@ -286,6 +291,7 @@
|
||||||
proc),
|
proc),
|
||||||
MACHINE.captureContinuationMarks()));
|
MACHINE.captureContinuationMarks()));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -195,11 +195,11 @@
|
||||||
// entity who is locking.
|
// entity who is locking.
|
||||||
if (this.locked === false || this.locked === id) {
|
if (this.locked === false || this.locked === id) {
|
||||||
this.locked = id;
|
this.locked = id;
|
||||||
onAcquire.call(
|
|
||||||
this,
|
|
||||||
// NOTE: the caller must release the lock or else deadlock!
|
|
||||||
function() {
|
|
||||||
setTimeout(
|
setTimeout(
|
||||||
|
function() {
|
||||||
|
onAcquire.call(
|
||||||
|
that,
|
||||||
|
// NOTE: the caller must release the lock or else deadlock!
|
||||||
function() {
|
function() {
|
||||||
var waiter;
|
var waiter;
|
||||||
if (that.locked === false) {
|
if (that.locked === false) {
|
||||||
|
@ -211,9 +211,9 @@
|
||||||
waiter = that.waiters.shift();
|
waiter = that.waiters.shift();
|
||||||
that.acquire(waiter.id, waiter.onAcquire);
|
that.acquire(waiter.id, waiter.onAcquire);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
0);
|
0);
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.waiters.push({ id: id,
|
this.waiters.push({ id: id,
|
||||||
onAcquire: onAcquire } );
|
onAcquire: onAcquire } );
|
||||||
|
@ -442,16 +442,16 @@
|
||||||
var recomputeMaxNumBouncesBeforeYield;
|
var recomputeMaxNumBouncesBeforeYield;
|
||||||
|
|
||||||
var scheduleTrampoline = function(MACHINE, f) {
|
var scheduleTrampoline = function(MACHINE, f) {
|
||||||
|
setTimeout(
|
||||||
|
function() {
|
||||||
MACHINE.exclusiveLock.acquire(
|
MACHINE.exclusiveLock.acquire(
|
||||||
'scheduleTrampoline',
|
'scheduleTrampoline',
|
||||||
function(release) {
|
function(release) {
|
||||||
setTimeout(
|
|
||||||
function() {
|
|
||||||
release();
|
release();
|
||||||
return MACHINE.trampoline(f);
|
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
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
(provide version)
|
(provide version)
|
||||||
(: version String)
|
(: version String)
|
||||||
|
|
||||||
(define version "1.97")
|
(define version "1.98")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user