(index ("gochan" 0) ("gochan-send" 269) ("gochan-recv" 430) ("gochan-close" 587) ("gochan-after" 1415) ("gochan-tick" 2395) ("go" 2839))
(def (sig (procedure " (gochan capacity)" (id gochan))) (p "Construct a channel with a maximum buffer-size of " (tt "capacity") ". If " (tt "capacity") " is " (tt "0") ", the channel is unbuffered and all its operations will block until a remote end sends/receives."))
(def (sig (procedure " (gochan-send chan msg)" (id gochan-send))) (p "This is short for " (tt "(gochan-select ((chan <- msg fail) (values  #f fail #t)))") "."))
(def (sig (procedure " (gochan-recv chan)" (id gochan-recv))) (p "This is short for " (tt "(gochan-select ((chan -> msg fail) (values msg fail #t)))") "."))
(def (sig (procedure " (gochan-close chan [fail-flag])" (id gochan-close))) (p "Close the channel. Note that this will unblock existing receivers and senders waiting for an operation on " (tt "chan") " with the " (tt "fail-flag") " set to a non-" (tt "#f") " value. All " (i "future") " receivers and senders will also immdiately unblock in this way, so watch out for busy-loops.") (p "The optional " (tt "fail-flag") " can be used to specify an alternative to the default " (tt "#t") ". As this value is given to all receivers and senders of " (tt "chan") ", the " (tt "fail-flag") " can be used as a \"broadcast\" mechanism. " (tt "fail-flag") " cannot be " (tt "#f") " as that would indicate a successful message transaction.") (p "Closing an already closed channel will results in its " (tt "fail-flag") " being updated."))
(def (sig (procedure " (gochan-after duration/ms)" (id gochan-after))) (p "Returns a " (tt "gochan") " that will \"send\" a single message after " (tt "duration/ms") " milliseconds of its creation. The message is the " (tt "(current-milliseconds)") " value at the time of the timeout (not when the message was received). Receiving more than once on an " (tt "gochan-after") " channel will block indefinitely or deadlock the second time.") (highlight scheme "    \n(gochan-select\n ((chan1 -> msg)                (print \"chan1 says \" msg))\n (((gochan-after 1000) -> when) (print \"chan1 took too long\")))") (p "You cannot send to or close a timer channel. These are special records that contain information about when the next timer will trigger. Creating timers is a relatively cheap operation, and unlike " (link "https://golang.org/pkg/time/#After" "golang.time.After") ", may be garbage-collected before the timer triggers. Creating a timer does not spawn a new thread."))
(def (sig (procedure " (gochan-tick duration/ms)" (id gochan-tick))) (p "Return a " (tt "gochan") " that will \"send\" a message every " (tt "duration/ms") " milliseconds. The message is the " (tt "(current-milliseconds)") " value at the time of the tick (not when it was received).") (p "See " (link "https://github.com/Adellica/chicken-gochan/blob/master/tests/worker-pool.scm" ((tt "tests/worker-pool.scm"))) " for an example of its use."))
(def (sig (syntax " (go body ...)" (id go))) (p "Starts and returns a new srfi-18 thread. Short for " (tt "(thread-start! (lambda () body ...))") "."))
