Skip to content

Commit c636a8a

Browse files
committed
---
yaml --- r: 14330 b: refs/heads/try c: 7550357 h: refs/heads/master v: v3
1 parent 692d3e5 commit c636a8a

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
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: 96af6f05a1881ba669637d3982a0d3315722c0d2
5+
refs/heads/try: 75503570c79d461ccb6e4ef0a9ad872a77ba60c4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_port_selector.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ rust_port_selector::rust_port_selector()
77

88
void
99
rust_port_selector::select(rust_task *task, rust_port **dptr,
10-
rust_port **ports,
11-
size_t n_ports, uintptr_t *yield) {
10+
rust_port **ports,
11+
size_t n_ports, uintptr_t *yield) {
1212

1313
I(task->thread, this->ports == NULL);
1414
I(task->thread, this->n_ports == 0);
@@ -29,33 +29,33 @@ rust_port_selector::select(rust_task *task, rust_port **dptr,
2929
// Start looking for ports from a different index each time.
3030
size_t j = isaac_rand(&task->thread->rctx);
3131
for (size_t i = 0; i < n_ports; i++) {
32-
size_t k = (i + j) % n_ports;
33-
rust_port *port = ports[k];
34-
I(task->thread, port != NULL);
32+
size_t k = (i + j) % n_ports;
33+
rust_port *port = ports[k];
34+
I(task->thread, port != NULL);
3535

36-
port->lock.lock();
37-
locks_taken++;
36+
port->lock.lock();
37+
locks_taken++;
3838

39-
if (port->buffer.size() > 0) {
40-
*dptr = port;
41-
found_msg = true;
42-
break;
43-
}
39+
if (port->buffer.size() > 0) {
40+
*dptr = port;
41+
found_msg = true;
42+
break;
43+
}
4444
}
4545

4646
if (!found_msg) {
47-
this->ports = ports;
48-
this->n_ports = n_ports;
49-
I(task->thread, task->rendezvous_ptr == NULL);
50-
task->rendezvous_ptr = (uintptr_t*)dptr;
51-
*yield = true;
52-
task->block(this, "waiting for select rendezvous");
47+
this->ports = ports;
48+
this->n_ports = n_ports;
49+
I(task->thread, task->rendezvous_ptr == NULL);
50+
task->rendezvous_ptr = (uintptr_t*)dptr;
51+
*yield = true;
52+
task->block(this, "waiting for select rendezvous");
5353
}
5454

5555
for (size_t i = 0; i < locks_taken; i++) {
56-
size_t k = (i + j) % n_ports;
57-
rust_port *port = ports[k];
58-
port->lock.unlock();
56+
size_t k = (i + j) % n_ports;
57+
rust_port *port = ports[k];
58+
port->lock.unlock();
5959
}
6060
}
6161

@@ -72,16 +72,16 @@ rust_port_selector::msg_sent_on(rust_port *port) {
7272
scoped_lock with(rendezvous_lock);
7373

7474
if (task->blocked_on(this)) {
75-
for (size_t i = 0; i < n_ports; i++) {
76-
if (port == ports[i]) {
77-
// This was one of the ports we were waiting on
78-
ports = NULL;
79-
n_ports = 0;
80-
*task->rendezvous_ptr = (uintptr_t) port;
81-
task->rendezvous_ptr = NULL;
82-
task->wakeup(this);
83-
return;
84-
}
85-
}
75+
for (size_t i = 0; i < n_ports; i++) {
76+
if (port == ports[i]) {
77+
// This was one of the ports we were waiting on
78+
ports = NULL;
79+
n_ports = 0;
80+
*task->rendezvous_ptr = (uintptr_t) port;
81+
task->rendezvous_ptr = NULL;
82+
task->wakeup(this);
83+
return;
84+
}
85+
}
8686
}
8787
}

0 commit comments

Comments
 (0)