Skip to content

Instantly share code, notes, and snippets.



Last active Nov 8, 2018
What would you like to do?
Example of a deadlock due to the lack of a better preemption in go scheduler
package main
import (
// Запускать через "go run no_preempt.go".
// См. также:
func main() {
go func() {
for {
// Строчку ниже можно убрать из-под комментария и программа перестанет зависать намертво.
// time.Sleep(1)
time.Sleep(100 * time.Millisecond)
fmt.Println("hello world")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment