mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-13 07:47:39 +02:00
Initial version of (thread-pool-release!)
This commit is contained in:
parent
d6cab5d789
commit
c3c99271c3
1 changed files with 11 additions and 1 deletions
|
@ -435,7 +435,17 @@
|
||||||
(shared-queue-add! (tp:jobq tp) (make-shared thunk)))
|
(shared-queue-add! (tp:jobq tp) (make-shared thunk)))
|
||||||
|
|
||||||
;; Stop all thread pool threads, effectively GC'ing the thread pool
|
;; Stop all thread pool threads, effectively GC'ing the thread pool
|
||||||
;; TODO: (define (thread-pool-release! tp . opts) ;; opt is how - 'terminate (unsafe) / join(safe)
|
;; For now just uses thread-terminate for this purpose. The theory being that each
|
||||||
|
;; thread is not supposed to hold its own state anyway, and the TP is finishing up,
|
||||||
|
;; so do not anticipate this termination method causing any problems with (EG)
|
||||||
|
;; orphaned resources, etc.
|
||||||
|
(define (thread-pool-release! tp)
|
||||||
|
(let ((terminate (lambda () (thread-terminate! (current-thread)))))
|
||||||
|
(for-each
|
||||||
|
(lambda (thread)
|
||||||
|
;; Force each thread to terminate
|
||||||
|
(thread-pool-push-task! tp terminate))
|
||||||
|
(tp:threads tp))))
|
||||||
|
|
||||||
; ?? - thread-pool-wait-all!
|
; ?? - thread-pool-wait-all!
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue