Code Explainers

Code explainers tagged #event-loop

rust
use crossbeam_channel::{Receiver, Sender, select, tick};
use std::time::Duration;
 
pub enum Command {

A channel-driven worker loop in Rust

channels select message-passing
Intermediate 9 steps
php
<?php
 
function fetchAll(array $urls, int $concurrency = 10, int $timeout = 15): array
{

Bounded-concurrency HTTP fetching with curl_multi

concurrency http curl
Advanced 8 steps
php
final class DebouncedSessionStore
{
    private array $pending = [];
    private array $timers = [];

Debouncing session writes with an event loop

debounce event-loop atomic-write
Advanced 9 steps
java
package com.example.fs;
 
import java.io.IOException;
import java.nio.file.FileSystems;

Watching a directory with Java NIO

file-io event-loop resource-management
Intermediate 8 steps