Goroutine (parallel control) that can be used in the field

func main() {
	ch := make(chan struct{}, 10)
	var wg sync.WaitGroup
	for i := 0; i < 1000; i++ {
		ch <- struct{}{}
		wg.Add(1)
		go func(i int) {
			defer func() {
				<-ch
				wg.Done()
			}()

			fmt.Println(i)
		}(i)
	}
	wg.Wait()
}

https://play.golang.org/p/Cry94fFpeFH

Recommended Posts

Goroutine (parallel control) that can be used in the field
Goroutine that can be used in the field (errgroup.Group edition)
A timer (ticker) that can be used in the field (can be used anywhere)
QPS control that can be used in the field (Rate Limit) Limits execution to n times per second
[Django] Field names, user registration, and login methods that can be used in the User model
Functions that can be used in for statements
Basic algorithms that can be used in competition pros
ANTs image registration that can be used in 5 minutes
Scripts that can be used when using bottle in Python
Python standard input summary that can be used in competition pro
Python standard module that can be used on the command line
About the matter that the re.compiled object can be used for the re.match pattern
Easy padding of data that can be used in natural language processing
Hide the warning that zsh can be used by default on Mac
File types that can be used with Go
Building Sphinx that can be written in Markdown
The problem that the ifconfig command cannot be used
A collection of Numpy, Pandas Tips that are often used in the field
A personal memo of Pandas related operations that can be used in practice
Easy program installer and automatic program updater that can be used in any language
I made a familiar function that can be used in statistics with Python
Japanese can be used with Python in Docker environment
Python knowledge notes that can be used with AtCoder
Can be used in competition pros! Python standard library
[Django] About users that can be used on template
List the classes that can be referenced by ObjCClass
Summary of statistical data analysis methods using Python that can be used in business
The story that sendmail that can be executed in the terminal did not work with cron
[Python] I examined the practice of asynchronous processing that can be executed in parallel with the main thread (multiprocessing, asyncio).
Simple statistics that can be used to analyze the effect of measures on EC sites and codes that can be used in jupyter notebook
Text analysis that can be done in 5 minutes [Word Cloud]
[Python3] Code that can be used when you want to resize images in folder units
[Atcoder] [C ++] I made a test automation tool that can be used during the contest
I investigated the pretreatment that can be done with PyCaret
Evaluation index that can be specified in GridSearchCV of sklearn
How to set variables that can be used throughout the Django app-useful for templates, etc.-
I made it because I want JSON data that can be used freely in demos and prototypes
I tried to expand the database so that it can be used with PES analysis software
I bought and analyzed the year-end jumbo lottery with Python that can be executed in Colaboratory
Understand the probabilities and statistics that can be used for progress management with a python program
About the matter that torch summary can be really used when building a model with Pytorch
Make a Spinbox that can be displayed in Binary with Tkinter
33 strings that should not be used as variable names in python
About character string handling that can be placed in JSON communication
New features in Python 3.9 (1)-Union operators can be used in dictionary types
Make a Spinbox that can be displayed in HEX with Tkinter
Create a custom field where enum can be specified in choices
Can the Kalman filter be used to predict stock price trends?
Confirmation that rkhunter can be installed
I wrote a tri-tree that can be used for high-speed dictionary implementation in D language and Python.
Solution to the problem that Ctrl + z cannot be used in Powershell in Docker for windows environment (provisional)
I created a template for a Python project that can be used universally
AtCoder C problem summary that can be solved in high school mathematics
Acoustic signal processing module that can be used with Python-Sounddevice ASIO [Application]
Serverless LINE Bot that can be done in 2 hours (source identifier acquisition)
The one that divides the csv file, reads it, and processes it in parallel
Mathematical optimization that can be used for free work with Python + PuLP
Maximum number of function parameters that can be defined in each language
I made a simple timer that can be started from the terminal
Acoustic signal processing module that can be used with Python-Sounddevice ASIO [Basic]
A story that heroku that can be done in 5 minutes actually took 3 days