func slowCalculator(a, b int) {
time.Sleep(3 * time.Second)
fmt.Printf("%d\n", a + b)
}
bus.Subscribe("main:slow_calculator", slowCalculator);
wait := bus.PublishAsync("main:slow_calculator", 30, 70);
fmt.Println("waiting for result")
// uncomment next 3 lines for awkward pause
fmt.Println("start: do some stuff while waiting for a result")
time.Sleep(2 * time.Second)
mt.Println("end: do some stuff while waiting for a result")
func slowCalculator(a, b int) { time.Sleep(3 * time.Second) fmt.Printf("%d\n", a + b) }
bus.Subscribe("main:slow_calculator", slowCalculator); wait := bus.PublishAsync("main:slow_calculator", 30, 70); fmt.Println("waiting for result")
// uncomment next 3 lines for awkward pause fmt.Println("start: do some stuff while waiting for a result") time.Sleep(2 * time.Second) mt.Println("end: do some stuff while waiting for a result")