aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-12-01 13:16:42 +0100
committerRon Evans <[email protected]>2024-12-04 09:43:10 +0100
commitb5a8931fb57ca93fdfcf9c4e443833cd0def2a8d (patch)
tree32d3026998942bfa4fc1499b47154f76b67ff847 /testdata
parentd3810ecd482ec8dc070e4aebb98d68f9b13fc3f7 (diff)
downloadtinygo-b5a8931fb57ca93fdfcf9c4e443833cd0def2a8d.tar.gz
tinygo-b5a8931fb57ca93fdfcf9c4e443833cd0def2a8d.zip
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.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/goroutines.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/testdata/goroutines.go b/testdata/goroutines.go
index 5ac3b7318..fe4347df9 100644
--- a/testdata/goroutines.go
+++ b/testdata/goroutines.go
@@ -1,7 +1,6 @@
package main
import (
- "runtime"
"sync"
"time"
)
@@ -83,8 +82,6 @@ func main() {
testGoOnInterface(Foo(0))
- testCond()
-
testIssue1790()
done := make(chan int)
@@ -172,47 +169,6 @@ func testGoOnBuiltins() {
}
}
-func testCond() {
- var cond runtime.Cond
- go func() {
- // Wait for the caller to wait on the cond.
- time.Sleep(time.Millisecond)
-
- // Notify the caller.
- ok := cond.Notify()
- if !ok {
- panic("notification not sent")
- }
-
- // This notification will be buffered inside the cond.
- ok = cond.Notify()
- if !ok {
- panic("notification not queued")
- }
-
- // This notification should fail, since there is already one buffered.
- ok = cond.Notify()
- if ok {
- panic("notification double-sent")
- }
- }()
-
- // Verify that the cond has no pending notifications.
- ok := cond.Poll()
- if ok {
- panic("unexpected early notification")
- }
-
- // Wait for the goroutine spawned earlier to send a notification.
- cond.Wait()
-
- // The goroutine should have also queued a notification in the cond.
- ok = cond.Poll()
- if !ok {
- panic("missing queued notification")
- }
-}
-
var once sync.Once
func testGoOnInterface(f Itf) {