starting to do something

This commit is contained in:
Danny Yoo 2011-12-04 18:43:25 -05:00
parent efb978b52f
commit 6904222c69
3 changed files with 143 additions and 137 deletions

View File

@ -128,6 +128,9 @@
var coerseClosureToJavaScript = function (v, MACHINE) {
var f = function (succ, fail) {
MACHINE.exclusiveLock.acquire(
"js-as-closure",
function(releaseLock) {
succ = succ || function () {};
fail = fail || function () {};
@ -188,10 +191,6 @@
fail(e);
};
MACHINE.exclusiveLock.acquire(
"js-as-closure",
function(releaseLock) {
releaseLock();
MACHINE.trampoline(v.label);
});
@ -223,6 +222,10 @@
// internallCallDuringPause: call a Racket procedure and get its results.
// The use assumes the machine is in a running-but-paused state.
var internalCallDuringPause = function (MACHINE, proc, success, fail) {
MACHINE.exclusiveLock.acquire(
"internal call during pause",
function(releaseLock) {
var i;
var oldArgcount, oldVal, oldProc, oldErrorHandler;
if (! baselib.arity.isArityMatching(proc.racketArity, arguments.length - 4)) {
@ -278,7 +281,9 @@
fail(e);
};
releaseLock();
MACHINE.trampoline(proc.label);
} else {
fail(baselib.exceptions.makeExnFail(
baselib.format.format(
@ -286,6 +291,7 @@
proc),
MACHINE.captureContinuationMarks()));
}
});
};

View File

@ -195,11 +195,11 @@
// entity who is locking.
if (this.locked === false || this.locked === id) {
this.locked = id;
onAcquire.call(
this,
// NOTE: the caller must release the lock or else deadlock!
function() {
setTimeout(
function() {
onAcquire.call(
that,
// NOTE: the caller must release the lock or else deadlock!
function() {
var waiter;
if (that.locked === false) {
@ -211,9 +211,9 @@
waiter = that.waiters.shift();
that.acquire(waiter.id, waiter.onAcquire);
}
});
},
0);
});
} else {
this.waiters.push({ id: id,
onAcquire: onAcquire } );
@ -442,16 +442,16 @@
var recomputeMaxNumBouncesBeforeYield;
var scheduleTrampoline = function(MACHINE, f) {
setTimeout(
function() {
MACHINE.exclusiveLock.acquire(
'scheduleTrampoline',
function(release) {
setTimeout(
function() {
release();
return MACHINE.trampoline(f);
MACHINE.trampoline(f);
});
},
0);
});
};
// Creates a restarting function, that reschedules f in a context

View File

@ -7,4 +7,4 @@
(provide version)
(: version String)
(define version "1.97")
(define version "1.98")