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
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & 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 zip
latestvk979tswav82eat9y13k9a9kbhx8300xq

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

  1. 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).
  2. 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).
  3. 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

GoalPreferAvoid
I/O-bound (network, disk)Async (async/await, asyncio, Promise) or thread poolMany blocking threads
CPU-bound (compute)Processes / process pool, or native threads (Java, Go, C#)Many threads in Python (GIL)
Shared mutable stateLocks (mutex), thread-safe collections, or avoid sharingNaked shared variables
Producer–consumerQueue (thread-safe)Busy-wait / ad-hoc signaling
Run N tasks in parallelThread pool or process poolManually creating N threads
ConceptOne-liner
Race conditionTwo threads read/write same data without synchronization; fix with lock or immutable design.
DeadlockTwo (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

NeedLocation
When to use threads vs processes vs asyncreference/concepts.md
Locks, queues, thread pool, shared state patternsreference/patterns.md
Python / Java / C# / Node / Go API quick refreference/languages.md
Starter code / templatesassets/

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 total
Select a file
Select a file to preview.

Comments

Loading comments…