Safe multi-threading API ======================== It could work by creating a thread pool, and having a different lists/maps(?) of objects for various types of sharing. Or some central "repository object" to allocate them. * Immutable * Per-thread - Mutable - Append-only and appearing as one list per thread - Append-only and appearing as one single list * Written by one fixed thread only * Written under a lock only * Written under a lock by one fixed thread only * Read under a lock only * Read under a lock by one fixed thread only * Accessed (read/written) under a lock only - Non-atomic access - Atomic access (maybe it should be an implementation-detail / optional optimization) * Per-thread counters, read at end * Per-thread counters, and read by one thread * Per-thread counters, and read periodcally/rarely by one thread * Limit counters (see "perfbook" below) See also: https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html