Skip to content

Commit 2dfdcdd

Browse files
committed
---
yaml --- r: 15812 b: refs/heads/try c: 5d625af h: refs/heads/master v: v3
1 parent 25cdaba commit 2dfdcdd

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: c424b7f847bbec50d01b00a89e044d80b8eb59f8
5+
refs/heads/try: 5d625af9f944c7b6567c443a6f796e30dbb01bf2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_task.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ rust_task::kill() {
248248
killed = true;
249249
// Unblock the task so it can unwind.
250250

251-
if (blocked()) {
251+
if (blocked() && must_fail_from_being_killed_unlocked()) {
252252
wakeup(cond);
253253
}
254254

@@ -648,11 +648,13 @@ rust_task::on_rust_stack() {
648648

649649
void
650650
rust_task::inhibit_kill() {
651+
scoped_lock with(kill_lock);
651652
disallow_kill = true;
652653
}
653654

654655
void
655656
rust_task::allow_kill() {
657+
scoped_lock with(kill_lock);
656658
disallow_kill = false;
657659
}
658660

branches/try/src/rt/rust_task.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ rust_task : public kernel_owned<rust_task>, rust_cond
149149
rust_cond *cond;
150150
const char *cond_name;
151151

152-
// Protects the killed flag
152+
// Protects the killed flag, disallow_kill flag, reentered_rust_stack
153153
lock_and_signal kill_lock;
154154
// Indicates that the task was killed and needs to unwind
155155
bool killed;
@@ -372,7 +372,10 @@ rust_task::call_on_rust_stack(void *args, void *fn_ptr) {
372372
assert(next_rust_sp);
373373

374374
bool had_reentered_rust_stack = reentered_rust_stack;
375-
reentered_rust_stack = true;
375+
{
376+
scoped_lock with(kill_lock);
377+
reentered_rust_stack = true;
378+
}
376379

377380
uintptr_t prev_c_sp = next_c_sp;
378381
next_c_sp = get_sp();
@@ -384,7 +387,10 @@ rust_task::call_on_rust_stack(void *args, void *fn_ptr) {
384387
__morestack(args, fn_ptr, sp);
385388

386389
next_c_sp = prev_c_sp;
387-
reentered_rust_stack = had_reentered_rust_stack;
390+
{
391+
scoped_lock with(kill_lock);
392+
reentered_rust_stack = had_reentered_rust_stack;
393+
}
388394
}
389395

390396
inline void

0 commit comments

Comments
 (0)