Skip to content

Commit b5a8931

Browse files
aykevldeadprogram
authored andcommitted
runtime: remove Cond
I don't think this is used anywhere right now, and it would need to be updated to work with multithreading. So instead of fixing it, I think we can remove it. My original intention was to have something like this that could be used in the machine package, but since this is in the runtime package (and the runtime package imports the machine package on baremetal) it can't actually be used that way. I checked the TinyGo repo and the drivers repo, and `runtime.Cond` isn't used anywhere except in that one test.
1 parent d3810ec commit b5a8931

File tree

3 files changed

+0
-172
lines changed

3 files changed

+0
-172
lines changed

src/runtime/cond.go

Lines changed: 0 additions & 90 deletions
This file was deleted.

src/runtime/cond_nosched.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

testdata/goroutines.go

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"runtime"
54
"sync"
65
"time"
76
)
@@ -83,8 +82,6 @@ func main() {
8382

8483
testGoOnInterface(Foo(0))
8584

86-
testCond()
87-
8885
testIssue1790()
8986

9087
done := make(chan int)
@@ -172,47 +169,6 @@ func testGoOnBuiltins() {
172169
}
173170
}
174171

175-
func testCond() {
176-
var cond runtime.Cond
177-
go func() {
178-
// Wait for the caller to wait on the cond.
179-
time.Sleep(time.Millisecond)
180-
181-
// Notify the caller.
182-
ok := cond.Notify()
183-
if !ok {
184-
panic("notification not sent")
185-
}
186-
187-
// This notification will be buffered inside the cond.
188-
ok = cond.Notify()
189-
if !ok {
190-
panic("notification not queued")
191-
}
192-
193-
// This notification should fail, since there is already one buffered.
194-
ok = cond.Notify()
195-
if ok {
196-
panic("notification double-sent")
197-
}
198-
}()
199-
200-
// Verify that the cond has no pending notifications.
201-
ok := cond.Poll()
202-
if ok {
203-
panic("unexpected early notification")
204-
}
205-
206-
// Wait for the goroutine spawned earlier to send a notification.
207-
cond.Wait()
208-
209-
// The goroutine should have also queued a notification in the cond.
210-
ok = cond.Poll()
211-
if !ok {
212-
panic("missing queued notification")
213-
}
214-
}
215-
216172
var once sync.Once
217173

218174
func testGoOnInterface(f Itf) {

0 commit comments

Comments
 (0)