ok matthew so what you propose is sync method callback right ? 2018-05-07 17:24 GMT+02:00 <matthewju...@gmail.com>:
> Corrected mistake: > > func SignalsCallback(arg1 int, arg2 string, callback chan<- struct{}) > > SignalsCallback will only write to callback, not read. > > Matt > > On Monday, May 7, 2018 at 10:08:27 AM UTC-5, matthe...@gmail.com wrote: >> >> Callbacks in Go can be done with a func argument to a func, or a similar >> effect can be made with channels by triggering a callback action by waiting >> on a blocking channel in the application. This Wikipedia article describes >> the pattern: https://en.wikipedia.org/wiki/Callback_(computer_programming >> ) >> >> // this func executes callback at some point >> // you can specify any func signature for callback when you construct >> your own func that calls back >> func CallsBack(arg1 int, arg2 string, callback func()) >> >> // this func sends a signal on callback that you listen for on another >> goroutine to execute your callback action >> // SignalsCallback may block until callback is read by you, or if the >> chan is buffered it may continue without callback being read >> func SignalsCallback(arg1 int, arg2 string, callback <-chan struct{}) >> >> The difference is that CallsBack will execute callback in order, while >> SignalsCallback will continue concurrently after callback is read by your >> goroutine. >> >> Matt >> >> On Friday, May 4, 2018 at 7:53:13 PM UTC-5, Eduardo Moseis Fuentes wrote: >>> >>> HI everyone I´m Eduardo from Guatemala and I'm beginer. I'm interesting >>> in all scope golang in fact I was download a little book about it, but I >>> need learn more about callbacks because the book don´t has enough >>> information on callbacks. May somebody tell me where can I find more >>> information?. HELP ME PLEASE THANKS God Bless you >>> >> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- - FLORENT GIRAUD - mail : *fgir...@student.42.fr <fgir...@student.42.fr>* - tel : *06.62.56.10.85* -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.