Skip to content

Commit 2378717

Browse files
committed
.
1 parent 04d10ea commit 2378717

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

server.coffee

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ process.on 'uncaughtException', (err) ->
2727
warn """\n
2828
^^^^^^^^^^^^^^^^^
2929
http://debuggable.com/posts/node-js-dealing-with-uncaught-exceptions:4c933d54-1428-443c-928d-4e1ecbdd56cb
30-
#{err.message}
31-
#{err.stack}
30+
#{err.stack ? err}
3231
vvvvvvvvvvvvvvvvv
3332
"""
3433

src/interpreter/kernel.coffee

+7-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ JThread = @JThread = clazz 'JThread', ->
143143
throw: (name, message) ->
144144
@error = name:name, message:message, stack:@callStack()
145145
assert.ok @state in [STATE_WAIT, STATE_RUNNING], "Thread was unexpectedly in #{@state} during a JThread.throw. Runtime error: #{name}/#{message}"
146-
if origState=@state is STATE_WAIT
146+
if (origState=@state) is STATE_WAIT
147147
@state = STATE_ERROR
148148
while waitKey=@waitKeys.pop()
149149
(waitList=@kernel.waitLists[waitKey]).remove @
@@ -165,7 +165,12 @@ JThread = @JThread = clazz 'JThread', ->
165165
@last = new JObject creator:@user, data:@error
166166
@error = undefined
167167
@state = STATE_RUNNING
168-
throw INTERRUPT_NONE
168+
if origState is STATE_WAIT
169+
@kernel.runloop.push @
170+
process.nextTick @kernel.runRunloop if @kernel.runloop.length is 1
171+
return
172+
else
173+
throw INTERRUPT_NONE
169174

170175
return: (result) ->
171176
assert.ok result?, "result value can't be undefined. Maybe JUndefined?"

tests/TODO

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* need to write unit tests for resuming threads by throw during a wait

0 commit comments

Comments
 (0)