concurrency/

directory
v0.0.0-...-b2ac4ad Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0

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/exercise3
Write a program that uses goroutines to generate up to 100 random numbers.
Write a program that uses goroutines to generate up to 100 random numbers.
exercises/exercise4
Write a program that creates a fixed set of workers to generate random numbers.
Write a program that creates a fixed set of workers to generate random numbers.
context
example1
Sample program to show how to store and retrieve values from a context.
Sample program to show how to store and retrieve values from a context.
example2
Sample program to show how to use the WithCancel function.
Sample program to show how to use the WithCancel function.
example3
Sample program to show how to use the WithDeadline function.
Sample program to show how to use the WithDeadline function.
example4
Sample program to show how to use the WithTimeout function of the Context package.
Sample program to show how to use the WithTimeout function of the Context package.
example5
Sample program that implements a web request with a context that is used to timeout the request if it takes too long.
Sample program that implements a web request with a context that is used to timeout the request if it takes too long.
example6
Sample program to show when a Context is canceled, all Contexts derived from it are also canceled.
Sample program to show when a Context is canceled, all Contexts derived from it are also canceled.
exercise1
Use the template and follow the directions.
Use the template and follow the directions.
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 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.
example4
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.
example5
Sample program to show how maps are not safe for concurrent use by default.
Sample program to show how maps are not safe for concurrent use by default.
exercise1
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.
exercise1
Create a program that declares two anonymous functions.
Create a program that declares two anonymous functions.
patterns
advanced
This sample program demonstrates how the logger package works.
This sample program demonstrates how the logger package works.

Jump to

Keyboard shortcuts

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