Files
libsst/libsst-concurrency/README.md
James Russell 71230f918f Add module READMEs, .gitignore, and remove Bin/ from tracking
Add README.md for each library module documenting API, platform
backends, and usage. Add .gitignore for build artifacts. Remove
pre-built binaries from version control.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:27:55 -05:00

31 lines
1.2 KiB
Markdown

# libsst-concurrency
Cross-platform threading and synchronization primitives in C, with C++ RAII
wrappers in ZUtil.
## Primitives
| Primitive | C API prefix | C++ wrapper |
|---|---|---|
| Threads | `SST_Concurrency_*Thread*` | `ZThread` |
| Mutexes | `SST_Concurrency_*Mutex*` | `ZMutex` / `ZLock` |
| Events | `SST_Concurrency_*Event*` | `ZEvent` |
| Semaphores | `SST_Concurrency_*Semaphore*` | `ZSemaphore` |
| Thread-local storage | `SST_Concurrency_*TLS*` | -- |
| Read-write locks | `SST_Concurrency_*ReadWrite*` | `ZReadWriteLock` |
| One-time init | `SST_Concurrency_ExecOnce` | -- |
| Thread barriers | `SST_Concurrency_*ThreadBarrier*` | -- |
## Platform backends
| Primitive | POSIX | Win32 | Solaris | macOS |
|---|---|---|---|---|
| Thread | pthread | `_beginthreadex` | `thr_*` | pthread |
| Mutex | `pthread_mutex_t` | `CRITICAL_SECTION` | `mutex_t` | pthread |
| Event | `pthread_cond_t` | `CreateEvent` | `cond_t` | pthread |
| Semaphore | `sem_t` | `CreateSemaphore` | `sema_t` | Custom (cond+mutex) |
| TLS | `pthread_key_t` | `TlsAlloc` | `thr_keycreate` | pthread |
Read-write locks and thread barriers use atomic spinlocks on all platforms
(depends on libsst-atomic).