mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
16fc1ea2bb
Match the Go runtime by terminating for deadlocks, stack overflows, runtime and GC invariants, invalid lock operations, and platform initialization failures instead of routing them through panic/recover. Keep language-level runtime errors and unsupported user operations recoverable. Add crash coverage that verifies fatal errors bypass deferred recover calls.
20 lines
805 B
Go
20 lines
805 B
Go
//go:build wasip1 && !scheduler.tasks && !scheduler.asyncify
|
|
|
|
package runtime
|
|
|
|
// sleepTicks blocks the current execution context for d ticks. This is the
|
|
// fallback used when no cooperative scheduler is configured (-scheduler=none
|
|
// or -scheduler=threads on wasip1) and it has no FD-polling integration —
|
|
// see scheduler_idle_wasip1.go for the cooperative variant.
|
|
func sleepTicks(d timeUnit) {
|
|
sleepTicksSubscription.u.u.timeout = uint64(d)
|
|
poll_oneoff(&sleepTicksSubscription, &sleepTicksResult, 1, &sleepTicksNEvents)
|
|
}
|
|
|
|
// waitForEvents is only meaningful when there's an event source available.
|
|
// Without the cooperative scheduler running poll_oneoff on FDs, wasip1 has
|
|
// nothing to wake on, so this is a hard deadlock.
|
|
func waitForEvents() {
|
|
runtimeFatal("deadlocked: no event source")
|
|
}
|