Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
4 CHANGES
@@ -2,6 +2,10 @@
lparallel Changes
=================
+= 1.3.3
+
+* internal cleanup
+
= 1.3.2
* add a few profile functions
View
2  lparallel.asd
@@ -35,7 +35,7 @@
(values))
(defsystem :lparallel
- :version "1.3.2"
+ :version "1.3.3"
:description "Parallelism for Common Lisp"
:long-description
"
View
17 src/kernel/classes.lisp
@@ -35,14 +35,17 @@
(context :type function)
(name :type string)))
-(defslots worker ()
- ((thread :reader thread)
- (running-category :reader running-category :initform nil)
- (index :reader worker-index :type fixnum)
- (from-worker :reader from-worker :initform (make-queue) :type queue)
- (to-worker :reader to-worker :initform (make-queue) :type queue)
+(defslots worker-notifications ()
+ ((handshake/from-worker :initform (make-queue))
+ (handshake/to-worker :initform (make-queue))
+ (exit-notification :initform (make-queue))))
+
+(defslots worker (worker-notifications)
+ ((thread :reader thread)
+ (running-category :reader running-category :initform nil)
+ (index :reader worker-index :type fixnum)
#+lparallel.with-stealing-scheduler
- (tasks :reader tasks :type spin-queue)))
+ (tasks :reader tasks :type spin-queue)))
#+lparallel.with-stealing-scheduler
(defslots scheduler ()
View
33 src/kernel/core.lisp
@@ -60,14 +60,22 @@
t))
(defun/type handshake/to-worker (worker) (worker) t
- (with-worker-slots (from-worker to-worker) worker
- (push-queue 'proceed to-worker)
- (assert (eq 'ok (pop-queue from-worker)))))
+ (with-worker-slots (handshake/from-worker handshake/to-worker) worker
+ (push-queue 'proceed handshake/to-worker)
+ (assert (eq 'ok (pop-queue handshake/from-worker)))))
(defun/type handshake/from-worker (worker) (worker) t
- (with-worker-slots (from-worker to-worker) worker
- (assert (eq 'proceed (pop-queue to-worker)))
- (push-queue 'ok from-worker)))
+ (with-worker-slots (handshake/from-worker handshake/to-worker) worker
+ (assert (eq 'proceed (pop-queue handshake/to-worker)))
+ (push-queue 'ok handshake/from-worker)))
+
+(defun/type notify-exit (worker) (worker) t
+ (with-worker-slots (exit-notification) worker
+ (push-queue 'exit exit-notification)))
+
+(defun/type wait-for-worker (worker) (worker) t
+ (with-worker-slots (exit-notification) worker
+ (assert (eq 'exit (pop-queue exit-notification)))))
(defun/type replace-worker (kernel worker) (kernel worker) t
(with-kernel-slots (workers workers-lock) kernel
@@ -130,12 +138,11 @@
(with-kernel-slots (worker-info) kernel
(with-worker-info-slots (bindings name) worker-info
(let* ((worker (%make-worker index tasks))
- (worker-thread (with-worker-slots (from-worker to-worker) worker
- (with-thread (:bindings bindings :name name)
- (unwind-protect/ext
- :prepare (handshake/from-worker worker)
- :main (enter-worker-loop kernel worker)
- :cleanup (push-queue 'exit from-worker))))))
+ (worker-thread (with-thread (:bindings bindings :name name)
+ (unwind-protect/ext
+ :prepare (handshake/from-worker worker)
+ :main (enter-worker-loop kernel worker)
+ :cleanup (notify-exit worker)))))
(with-worker-slots (thread) worker
(setf thread worker-thread))
worker))))
@@ -344,7 +351,7 @@ return value is the number of tasks that would have been killed if
(repeat (length workers)
(schedule-task scheduler nil :low))
(dosequence (worker workers)
- (assert (eq 'exit (pop-queue (from-worker worker)))))))
+ (wait-for-worker worker))))
(defun end-kernel (&key wait)
"Sets `*kernel*' to nil and ends all workers gracefully.

No commit comments for this range

Something went wrong with that request. Please try again.