Code Explainers

Code explainers tagged #semaphore

java
public class RequestThrottler {
 
    private final Semaphore permits;
    private final long acquireTimeoutMillis;

Bounding concurrency with a Semaphore in Java

concurrency semaphore rate-limiting
Intermediate 6 steps
python
import asyncio
from dataclasses import dataclass
 
import aiohttp

Bounded-concurrency HTTP fetching with asyncio

async concurrency semaphore
Intermediate 8 steps
go
package fetcher
 
import (
	"context"

Bounded-concurrency HTTP fetching in Go

concurrency semaphore context-cancellation
Advanced 9 steps