feat(v1.4.1): add native proposal module, Lover Accept Checker AI, and modules documentation catalog
This commit is contained in:
1 parent
4895c201c1
commit
b7ae6c9725
20 files changed
+600
-34
No files matched your search
@@ -0,0 +1,25 @@
|
||||
# 🧵 AiraLang `thread` Module
|
||||
> **Concurrency, Worker Pools & Multithreading**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "thread";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `thread.spawn(fn, [args])`: Launch function in background thread.
|
||||
- `thread.join(thread_handle, [timeout])`: Wait for thread completion.
|
||||
- `thread.sleep(seconds)`: Thread sleep delay.
|
||||
- `thread.pool(fn, items, [max_workers=5])`: Parallel execution over collection.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "thread";
|
||||
|
||||
fn task(id) {
|
||||
return "Task " + id + " done";
|
||||
}
|
||||
|
||||
let res = thread.pool(task, [1, 2, 3, 4], 4);
|
||||
say res;
|
||||
```
|
||||
Reference in new issue
Block a user