You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import (
zmq "github.com/pebbe/zmq4"
"fmt"
)
var publisher *zmq.Socket
func publishRoutine() {
for {
publisher.Send("Hello", 0)
fmt.Printf("\nEvent publisher")
}
}
func main() {
var err error
publisher, err = zmq.NewSocket(zmq.PUB)
defer publisher.Close()
publisher.Bind("tcp://*:5562")
if nil != err {}
//start a go routine to continously publish the events
go publishRoutine()
//blocker for main exit
for {}
}
Build the code : $ go build sample.go
Run the sample: $ ./sample
Expected: It should continuously publish the events. Actual: It is hanging after publishing some events.
The text was updated successfully, but these errors were encountered:
jay11ca39
changed the title
zmq4 publisher issue, publisher is hanging while publishing infintely
zmq4 publisher issue, publisher is hanging while publishing continuously on socket
Oct 6, 2017
That for{} loop is for blocking for application to exit.
BTW When i tested without go routine it worked well. But is it the problem with go routine to switch between main and new thread?
Hello @pebbe
Steps to reproduce the issue:
package main
Build the code :
$ go build sample.go
Run the sample:
$ ./sample
Expected: It should continuously publish the events.
Actual: It is hanging after publishing some events.
The text was updated successfully, but these errors were encountered: