Directories ¶
Path | Synopsis |
---|---|
channels
|
|
advanced/example1
Sample program to show the order of channel communication for unbuffered, buffered and closing channels based on the specification.
|
Sample program to show the order of channel communication for unbuffered, buffered and closing channels based on the specification. |
example1
This sample program demonstrates the basic channel mechanics for goroutine signaling.
|
This sample program demonstrates the basic channel mechanics for goroutine signaling. |
example2
Sample program to show how to use an unbuffered channel to simulate a game of tennis between two goroutines.
|
Sample program to show how to use an unbuffered channel to simulate a game of tennis between two goroutines. |
example3
Sample program to show how to use an unbuffered channel to simulate a relay race between four goroutines.
|
Sample program to show how to use an unbuffered channel to simulate a relay race between four goroutines. |
example4
This sample program demonstrates how to use a buffered channel to receive results from other goroutines in a guaranteed way.
|
This sample program demonstrates how to use a buffered channel to receive results from other goroutines in a guaranteed way. |
example5
This sample program demonstrates how to use a channel to monitor the amount of time the program is running and terminate the program if it runs too long.
|
This sample program demonstrates how to use a channel to monitor the amount of time the program is running and terminate the program if it runs too long. |
exercises/exercise1
Write a program where two goroutines pass an integer back and forth ten times.
|
Write a program where two goroutines pass an integer back and forth ten times. |
exercises/exercise2
Write a program that uses a fan out pattern to generate 100 random numbers concurrently.
|
Write a program that uses a fan out pattern to generate 100 random numbers concurrently. |
exercises/template1
Write a program where two goroutines pass an integer back and forth ten times.
|
Write a program where two goroutines pass an integer back and forth ten times. |
exercises/template2
Write a program that uses a fan out pattern to generate 100 random numbers concurrently.
|
Write a program that uses a fan out pattern to generate 100 random numbers concurrently. |
data_race
|
|
advanced/example1
Sample program to show a more complicated race condition using an interface value.
|
Sample program to show a more complicated race condition using an interface value. |
example1
Sample program to show how to create race conditions in our programs.
|
Sample program to show how to create race conditions in our programs. |
example2
Sample program to show how to use the atomic package to provide safe access to numeric types.
|
Sample program to show how to use the atomic package to provide safe access to numeric types. |
example3
Sample program to show how to use the atomic package functions Store and Load to provide safe access to numeric types.
|
Sample program to show how to use the atomic package functions Store and Load to provide safe access to numeric types. |
example4
Sample program to show how to use a mutex to define critical sections of code that need synchronous access.
|
Sample program to show how to use a mutex to define critical sections of code that need synchronous access. |
example5
Sample program to show how to use a read/write mutex to define critical sections of code that needs synchronous access.
|
Sample program to show how to use a read/write mutex to define critical sections of code that needs synchronous access. |
exercises/exercise1
Answer for exercise 1 of Race Conditions.
|
Answer for exercise 1 of Race Conditions. |
exercises/template1
Fix the race condition in this program.
|
Fix the race condition in this program. |
goroutines
|
|
example1
Sample program to show how to create goroutines and how the scheduler behaves.
|
Sample program to show how to create goroutines and how the scheduler behaves. |
example2
Sample program to show how the goroutine scheduler will time slice goroutines on a single thread.
|
Sample program to show how the goroutine scheduler will time slice goroutines on a single thread. |
example3
Sample program to show how to create goroutines and how the goroutine scheduler behaves with two contexts.
|
Sample program to show how to create goroutines and how the goroutine scheduler behaves with two contexts. |
exercises/exercise1
Create a program that declares two anonymous functions.
|
Create a program that declares two anonymous functions. |
exercises/template1
Create a program that declares two anonymous functions.
|
Create a program that declares two anonymous functions. |
patterns
|
|
chat
Package chat implements a basic chat room.
|
Package chat implements a basic chat room. |
chat/main
This sample program demonstrates how to create a simple chat system.
|
This sample program demonstrates how to create a simple chat system. |
logger
Package logger shows a pattern of using a buffer to handle log write continuity but deal with write latencies by throwing away log data.
|
Package logger shows a pattern of using a buffer to handle log write continuity but deal with write latencies by throwing away log data. |
logger/main
This sample program demonstrates how the logger package works.
|
This sample program demonstrates how the logger package works. |
pool
Package pool manages a user defined set of resources.
|
Package pool manages a user defined set of resources. |
pool/main
This sample program demonstrates how to use the pool package to share a simulated set of database connections.
|
This sample program demonstrates how to use the pool package to share a simulated set of database connections. |
task
Package task provides a pool of goroutines to perform tasks.
|
Package task provides a pool of goroutines to perform tasks. |
task/main
This sample program demonstrates how to use the work package to use a pool of goroutines to get work done.
|
This sample program demonstrates how to use the work package to use a pool of goroutines to get work done. |
Click to show internal directories.
Click to hide internal directories.