changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/tests/task.lisp

changeset 563: 8b10eabe89dd
child: 295ea43ceb2d
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 28 Jul 2024 20:49:47 -0400
permissions: -rw-r--r--
description: std/tests, clap tweaks
1 ;;; tests/task.lisp --- Task Tests
2 
3 ;;
4 
5 ;;; Code:
6 (in-package :std/tests)
7 (in-suite :std)
8 
9 (deftest tasks ()
10  "Test task-pools, oracles, and workers."
11  (let ((pool (designate-oracle (make-task-pool) (make-oracle *current-thread*))))
12  ;; pool is bound to a task pool, *ORACLE-THREADS* contains the *CURRENT-THREAD*.
13  (spawn-workers pool 16)
14  ;; (with-threads (16 :args (&optional (a 0) (b 1) (c 2)))
15  ;; (sb-thread:allocator-histogram)
16  ;; (sb-concurrency:wait-on-gate (std/thread::task-pool-online pool))
17  ;; (print (+ a b c)))
18  (is (= 16 (length (task-pool-workers pool))))
19  (is (sb-thread:semaphore-count (std/task::task-pool-online pool)))))