initial import
src/thread.lisp
Fri Apr 3 00:17:02 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* initial import
--- old-qt.tests/src/thread.lisp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.tests/src/thread.lisp 2014-10-30 07:59:54.000000000 +0100
@@ -0,0 +1,40 @@
+(in-package :qt.tests)
+
+(5am:in-suite :qt.suite)
+
+;;; FIXME implement something sensibel and test
+;;; that it realy tests for races.
+
+
+(defmacro parallel-test (&body body)
+ "Executes BODY concurrently by using threads and tests
+wherther all tests are successfull."
+ (let ((threads (gensym))
+ (thread (gensym)))
+ `(let ((,threads nil))
+ (with-timeout (5)
+ (dotimes (,(gensym) 2)
+ (push (make-thread #'(lambda () ,@body))
+ ,threads))
+ (dolist (,thread ,threads)
+ (5am:is (eql (5am:results-status (join-thread ,thread))
+ t)))))))
+
+#|
+(5am:test (bytearray-threads :depends-on make-bytearray)
+ "Concurrent qbytearray creation."
+ (parallel-test
+ (dotimes (x 5)
+ (5am:run 'make-bytearray))))
+ |#
+
+;; FIXME this test does not work realibly
+#|
+(5am:test (gc-object-threads :depends-on gc-object)
+ "Concurrent garbage collenction."
+ (parallel-test
+ (dotimes (x 2)
+ (5am:run 'gc-object))))
+
+
+|#