All Projects → workshop-depot → goroutines

workshop-depot / goroutines

Licence: MIT license
provides utilities to perform common tasks on goroutines

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to goroutines

myconcurrent
Java并发的系统性学习
Stars: ✭ 25 (+31.58%)
Mutual labels:  concurrent-programming, concurrent
mapreduce
A in-process MapReduce library to help you optimizing service response time or concurrent task processing.
Stars: ✭ 93 (+389.47%)
Mutual labels:  concurrent-programming, concurrent
Routine
go routine control, abstraction of the Main and some useful Executors.如果你不会管理Goroutine的话,用它
Stars: ✭ 40 (+110.53%)
Mutual labels:  concurrent, goroutine
practice
Java并发编程与高并发解决方案:http://coding.imooc.com/class/195.html Java开发企业级权限管理系统:http://coding.imooc.com/class/149.html
Stars: ✭ 39 (+105.26%)
Mutual labels:  concurrent-programming, concurrent
Tascalate Concurrent
Implementation of blocking (IO-Bound) cancellable java.util.concurrent.CompletionStage and related extensions to java.util.concurrent.ExecutorService-s
Stars: ✭ 144 (+657.89%)
Mutual labels:  concurrent-programming, concurrent
Zio
ZIO — A type-safe, composable library for async and concurrent programming in Scala
Stars: ✭ 3,167 (+16568.42%)
Mutual labels:  concurrent-programming, concurrent
Fgbase
Ready-send coordination layer on top of goroutines.
Stars: ✭ 45 (+136.84%)
Mutual labels:  concurrent, goroutine
Dashmap
Blazing fast concurrent HashMap for Rust.
Stars: ✭ 1,128 (+5836.84%)
Mutual labels:  concurrent-programming, concurrent
Util
A collection of useful utility functions
Stars: ✭ 201 (+957.89%)
Mutual labels:  utility, concurrent
java-multithread
Códigos feitos para o curso de Multithreading com Java, no canal RinaldoDev do YouTube.
Stars: ✭ 24 (+26.32%)
Mutual labels:  concurrent-programming, concurrent
vanilla-docker
A sweet Docker setup for Vanilla Forums
Stars: ✭ 34 (+78.95%)
Mutual labels:  utility
talepy
📚Coordinate "transactions" across a number of services in python
Stars: ✭ 20 (+5.26%)
Mutual labels:  concurrent
Quickeys
A mac menu bar app that provides note taking functionality though a quick dropdown menu.
Stars: ✭ 54 (+184.21%)
Mutual labels:  utility
mpu
Martins Python Utilities - Stuff that comes in Handy
Stars: ✭ 47 (+147.37%)
Mutual labels:  utility
utilsac
Utility functions
Stars: ✭ 13 (-31.58%)
Mutual labels:  utility
pe-util
List shared object dependencies of a portable executable (PE)
Stars: ✭ 45 (+136.84%)
Mutual labels:  utility
FastDMG
Fast, no-nonsense disk image mounting for macOS
Stars: ✭ 72 (+278.95%)
Mutual labels:  utility
black hole flutter
🛠 A package absorbing all Flutter utility functions, including extension functions and commonly used widgets
Stars: ✭ 18 (-5.26%)
Mutual labels:  utility
goroutine-pool
A simple goroutine pool which can create and release goroutine dynamically, inspired by fasthttp.
Stars: ✭ 31 (+63.16%)
Mutual labels:  goroutine
cra-tailwindcss-in-js
Integrate Tailwind CSS in a Create React App setup using css-in-js solutions
Stars: ✭ 35 (+84.21%)
Mutual labels:  utility

goroutines

This package provides utilities to perform common tasks on goroutines - waiting for a goroutine to start, timeouts, do somethting before or after a goroutine function inside the same goroutine and recover from panic. It has a simple fluent API (see tests).

For example, here we wait for the goroutine to start, also perform some action afterward in a deffered manner, so even if the goroutine panics, it would get done. Also we recover from panic and handle the error:

err := New().
	EnsureStarted().
	Recover(func(e interface{}) {
		// error (panic) handling ...
	}).
	After(func() {
		result += `3`
	}, true).
	Go(func() {
		result += `2`
		panic(`ERR`)
	})

if err != nil {
    // ...
}

Other patterns also can be implemented using these basic abstractions, such as a simple supervisor:

func simpleSupervisor(intensity int, fn func()) {
	if intensity <= 0 {
		return
	}
	intensity--
	New().
		Recover(func(e interface{}) {
			time.Sleep(time.Millisecond * 10)
			go simpleSupervisor(intensity, fn)
		}).
		Go(fn)
}

Here simpleSupervisor(...) will restart a goroutine for a function, in case of a panic(...), number of intensity times. And we can use it as:

go simpleSupervisor(9, func() {
	// ...
})

This restarts the function at most, nine times and then stops. If we needed the function to run forever, we could simply drop intensity, or handle a value of -1.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].