Thread
Provides guidance and code examples for using threads, synchronization, thread pools, and concurrency patterns across languages.
MIT-0 · Free to use, modify, and redistribute. No attribution required.
⭐ 0 · 20 · 0 current installs · 0 all-time installs
byopenlang@openlang-cn
MIT-0
Security Scan
OpenClaw
Benign
high confidencePurpose & Capability
The name and description (threading/concurrency guidance) align with the included reference docs and example code. No unrelated binaries, env vars, or config paths are requested.
Instruction Scope
SKILL.md limits the agent to clarifying language/runtime, giving guidance, citing reference files, and adapting provided templates. It does not instruct reading unrelated files, exfiltrating data, or calling external endpoints.
Install Mechanism
No install spec is provided (instruction-only with bundled example assets). That minimizes disk-write/remote-download risk; included Python examples use only the standard library.
Credentials
The skill requires no environment variables or credentials. The included code does not reference secrets or external services.
Persistence & Privilege
The skill is not forced-always and uses normal autonomous invocation settings. It does not request persistent system-wide privileges or modify other skills' configurations.
Assessment
This skill appears coherent and low-risk: it only provides docs and small Python examples and asks for no credentials or installs. Before using: (1) review any code snippets before executing them in your environment (the Python examples are benign standard-library code); (2) if you ask the skill to generate or fetch language-specific templates that require external packages, be careful about installing third-party packages; (3) note that the skill can be invoked autonomously by the agent (standard behavior) — if you want tighter control, invoke it manually.Like a lobster shell, security has layers — review code before you run it.
Current versionv1.0.0
Download ziplatest
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
SKILL.md
Thread Skill — How to Work
Use this skill when the user asks about threads or concurrency: starting threads, thread pools, locks/mutex, race conditions, thread-safe code, or choosing between threads / processes / async.
Your Workflow
- Clarify context: Identify language/runtime (Python, Java, C#, Node.js, Go, etc.) and what they want (I/O-bound vs CPU-bound, parallelism vs concurrency).
- Choose the right tool: Prefer the language’s recommended approach (e.g. async in Node/Python for I/O; threads or processes for CPU; see reference/concepts.md).
- Give the right level of detail:
- Quick answer: Use the Quick Reference below and reply with a minimal example in their language.
- Patterns and pitfalls: Point to or quote reference/patterns.md (locks, queues, thread pool, shared state).
- Language API: Point to reference/languages.md or write a short snippet following that reference.
- Templates: Use or adapt code in assets/ when the user wants a starter or copy-paste pattern.
Quick Reference
| Goal | Prefer | Avoid |
|---|---|---|
| I/O-bound (network, disk) | Async (async/await, asyncio, Promise) or thread pool | Many blocking threads |
| CPU-bound (compute) | Processes / process pool, or native threads (Java, Go, C#) | Many threads in Python (GIL) |
| Shared mutable state | Locks (mutex), thread-safe collections, or avoid sharing | Naked shared variables |
| Producer–consumer | Queue (thread-safe) | Busy-wait / ad-hoc signaling |
| Run N tasks in parallel | Thread pool or process pool | Manually creating N threads |
| Concept | One-liner |
|---|---|
| Race condition | Two threads read/write same data without synchronization; fix with lock or immutable design. |
| Deadlock | Two (or more) threads wait for each other’s lock; fix by consistent lock order or timeouts. |
| GIL (Python) | Only one thread runs Python bytecode at a time; use processes or C extensions for CPU-bound. |
Where to Look
| Need | Location |
|---|---|
| When to use threads vs processes vs async | reference/concepts.md |
| Locks, queues, thread pool, shared state patterns | reference/patterns.md |
| Python / Java / C# / Node / Go API quick ref | reference/languages.md |
| Starter code / templates | assets/ |
Safety and Best Practices
- Do not suggest shared mutable state without synchronization (lock, queue, or thread-safe structure).
- Prefer higher-level constructs: thread pool, queue, async, instead of raw threads where they fit.
- For Python CPU-bound work, suggest multiprocessing or clarify GIL limits; for I/O-bound, suggest threading or asyncio as appropriate.
- When the user reports deadlock or race, point to reference/patterns.md and suggest minimal repro + lock discipline or queue-based design.
Assets
- assets/python-thread-starter.py — Minimal Python threading + lock example.
- assets/python-thread-pool.py — Thread pool (e.g.
concurrent.futures) example.
Add or reference other language templates in assets/ when the user asks for a specific runtime.
Files
9 totalSelect a file
Select a file to preview.
Comments
Loading comments…
