Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rarely crash... [termbox.go:234 +0x96] #3

Closed
kurehajime opened this issue Feb 25, 2016 · 1 comment
Closed

Rarely crash... [termbox.go:234 +0x96] #3

kurehajime opened this issue Feb 25, 2016 · 1 comment

Comments

@kurehajime
Copy link
Owner

Crash!

@kurehajime kurehajime changed the title termbox.go:234 +0x96 Rarely crash... [termbox.go:234 +0x96] Feb 25, 2016
@kurehajime
Copy link
Owner Author

see.

flush is not goroutine friendly - nsf/termbox-go

NG.

func funcA(){
    while{
        termbox.Flush()
    }
}
func funcB(){
    while{
        termbox.Flush()
    }
}
go funcA()
go funcB()

Change single goroutine.

OK.

flush  = make(chan int)
func termSync() {
    for {
        flg := <-flush
        if flg == -1 {
            break
        }
        termbox.Flush()
    }
}
func funcA(){
    while{
        flush <- 1
    }
}
func funcB(){
    while{
        flush <- 1
    }
}
go termSync()
go funcA()
go funcB()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant