# ephf/quark-threads architecture

> Architecture diagram of the GitHub repository ephf/quark-threads, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ephf/quark-threads
- Repository: https://github.com/ephf/quark-threads

## Overview

Quark Threads is a small Quark wrapper for pthreads. The documented workflow creates threads with payloads, protects shared data with a mutex, and waits for threads to finish. The README supports these relationships; no source excerpts were provided, so internal implementation details are omitted.

Main entry points: [`lib/threads.qk`](https://github.com/ephf/quark-threads/blob/main/lib/threads.qk) (Thread API)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_quark_app(("Quark application"))
node_thread_api["Thread API<br/>[threads.qk]"]
node_mutex_api["Mutex API<br/>[threads.qk]"]
node_pthreads["POSIX threads"]

node_quark_app -->|"creates and waits"| node_thread_api
node_quark_app -->|"locks shared data"| node_mutex_api
node_thread_api -->|"wraps"| node_pthreads
node_mutex_api -->|"wraps"| node_pthreads

click node_thread_api "https://github.com/ephf/quark-threads/blob/main/lib/threads.qk"
click node_mutex_api "https://github.com/ephf/quark-threads/blob/main/lib/threads.qk"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_quark_app,node_pthreads toneIndigo
class node_thread_api,node_mutex_api toneMint
```

## Components

### Other components

- **Quark application**
- [Thread API](https://github.com/ephf/quark-threads/blob/main/lib/threads.qk): `lib/threads.qk`
- [Mutex API](https://github.com/ephf/quark-threads/blob/main/lib/threads.qk): `lib/threads.qk`
- **POSIX threads**

## Connections

- Quark application → Thread API: creates and waits (evidence: `README.md`)
- Quark application → Mutex API: locks shared data (evidence: `README.md`)
- Thread API → POSIX threads: wraps (evidence: `README.md`)
- Mutex API → POSIX threads: wraps (evidence: `README.md`)
