Skip to content

Commit 835601e

Browse files
committed
---
yaml --- r: 14055 b: refs/heads/try c: 9fa950e h: refs/heads/master i: 14053: faf934e 14051: d7e7376 14047: 52a3e5d v: v3
1 parent ea9b10e commit 835601e

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
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: 21d783c33844028d8baa0d4d022fc244fc3ba77b
5+
refs/heads/try: 9fa950ec53dc7428d2d4a20ba56a50c21d5606a5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_kernel.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,27 @@ rust_kernel::fail() {
8484

8585
void
8686
rust_kernel::register_task(rust_task *task) {
87+
int new_live_tasks;
8788
{
8889
scoped_lock with(task_lock);
8990
task->user.id = max_task_id++;
9091
task_table.put(task->user.id, task);
92+
new_live_tasks = ++live_tasks;
9193
}
9294
K(srv, task->user.id != INTPTR_MAX, "Hit the maximum task id");
9395
KLOG_("Registered task %" PRIdPTR, task->user.id);
94-
int new_live_tasks = sync::increment(live_tasks);
9596
KLOG_("Total outstanding tasks: %d", new_live_tasks);
9697
}
9798

9899
void
99100
rust_kernel::release_task_id(rust_task_id id) {
100101
KLOG_("Releasing task %" PRIdPTR, id);
102+
int new_live_tasks;
101103
{
102104
scoped_lock with(task_lock);
103105
task_table.remove(id);
106+
new_live_tasks = --live_tasks;
104107
}
105-
int new_live_tasks = sync::decrement(live_tasks);
106108
KLOG_("Total outstanding tasks: %d", new_live_tasks);
107109
if (new_live_tasks == 0) {
108110
// There are no more tasks and there never will be.

branches/try/src/rt/rust_kernel.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ class rust_kernel {
2222
private:
2323
rust_scheduler *sched;
2424

25+
// Protects live_tasks, max_task_id and task_table
26+
lock_and_signal task_lock;
2527
// Tracks the number of tasks that are being managed by
2628
// schedulers. When this hits 0 we will tell all schedulers
2729
// to exit.
28-
volatile int live_tasks;
29-
// Protects max_task_id and task_table
30-
lock_and_signal task_lock;
30+
int live_tasks;
31+
// The next task id
3132
rust_task_id max_task_id;
3233
hash_map<rust_task_id, rust_task *> task_table;
3334

0 commit comments

Comments
 (0)