1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Configuration for unified channels.
/// Capacity used by every channel constructor that does not take one.
///
/// Channels are bounded by default: an unbounded queue lets a producer that
/// outruns its consumer convert backpressure into unbounded memory growth,
/// which is a liveness failure under adversarial or merely bursty load. The
/// default therefore has to be a number, and this is it.
///
/// Derivation: 1024 slots is large enough that a producer burst spanning a
/// scheduler quantum never blocks on an otherwise-keeping-up consumer (the
/// runtime's own queue capacity is 256 jobs per worker), and small enough that
/// the resident bound is one pointer-sized slot array — 8 KiB for a
/// word-sized payload — per channel rather than a function of producer speed.
/// Power of two so the bounded MPMC ring uses it without rounding up.
///
/// Callers whose producer/consumer rates are known should pass an explicit
/// capacity instead of inheriting this one.
pub const DEFAULT_CHANNEL_CAPACITY: usize = 1024;
/// Channel configuration for unified memory management