go-channel-compendium

module
v0.0.0-...-58980d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2016 License: MIT

README

#Go Channel Compendium Interesting ways of using Go channels by John Graham-Cumming


Overview

This is a code archive taken from the slides of John Graham-Cumming's presentation of 'A Channel Compendium' given at GopherCon 2014.

Video

https://www.youtube.com/watch?v=SmoM1InWXr0

Contents

Directories

Path Synopsis
examples
first-response
In this example, an array of web URL's are iterated upon and passed individually to separate goroutines.
In this example, an array of web URL's are iterated upon and passed individually to separate goroutines.
http-load-balancer
In this example, a load balancer has been created building upon previous examples.
In this example, a load balancer has been created building upon previous examples.
network-multiplexer
This example demonstrates a simple network multiplexer.
This example demonstrates a simple network multiplexer.
passing-a-channel
In this example, the w channel is created to transfer a unit of work to a goroutine.
In this example, the w channel is created to transfer a unit of work to a goroutine.
hide-state
capped-memory-recycler
In this example, a single buffered channel is used as a store for our memory buffers.
In this example, a single buffered channel is used as a store for our memory buffers.
memory-recycler
In this example, a goroutine is started to recycle memory buffers.
In this example, a goroutine is started to recycle memory buffers.
unique-id-service
In this example, a goroutine is started to generate unique hexadecimal id's.
In this example, a goroutine is started to generate unique hexadecimal id's.
nil-channels
disable-receiving-case-statements
In this example, a goroutine is started and using a select tries to receive on two channels.
In this example, a goroutine is started and using a select tries to receive on two channels.
disable-sending-case-statements
In this example, a goroutine is started to generate random numbers and send them on the c channel.
In this example, a goroutine is started to generate random numbers and send them on the c channel.
signalling
coordinate-multiple-goroutines
In this example, a hundred goroutines are started, waiting for communication of data on the start channel (or for it to be closed).
In this example, a hundred goroutines are started, waiting for communication of data on the start channel (or for it to be closed).
terminate-workers
In this example, a hundred goroutines are started, waiting for communication of data on the die channel (or for it to be closed).
In this example, a hundred goroutines are started, waiting for communication of data on the die channel (or for it to be closed).
verify-terminate-workers
In this example, a goroutine is started, waiting for communication of data on the die channel (or for it to be closed).
In this example, a goroutine is started, waiting for communication of data on the die channel (or for it to be closed).
wait-for-an-event
In this example, a goroutine is started, does some work (in this case waiting for five seconds) then closes the channel.
In this example, a goroutine is started, does some work (in this case waiting for five seconds) then closes the channel.
timers
heartbeat
In this example, a goroutine is started to do some work.
In this example, a goroutine is started to do some work.
timeout
In this example, a goroutine is started to do some work.
In this example, a goroutine is started to do some work.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL