r10151: updates
[kmrcl.git] / processes.lisp
index 0c9175fc8d8579917071789cf708e4546404be49..88aa05113da3613e973a863dd318fc2d4d275be9 100644 (file)
@@ -7,24 +7,24 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  June 2003
 ;;;;
-;;;; $Id: processes.lisp,v 1.1 2003/07/08 16:12:40 kevin Exp $
+;;;; $Id$
 ;;;; *************************************************************************
 
 (in-package #:kmrcl)
 
 
 (defun make-process (name func)
-  #+cmu (mp:make-process func :name name)
   #+allegro (mp:process-run-function name func)
+  #+cmu (mp:make-process func :name name)
   #+lispworks (mp:process-run-function name nil func)
   #+sb-thread (sb-thread:make-thread func)
-  #+clisp (funcall func)
+  #-(or allegro cmu lispworks sb-thread) (funcall func)
   )
 
 (defun destroy-process (process)
   #+cmu (mp:destroy-process process)
   #+allegro (mp:process-kill process)
-  #+sbcl-thread (sb-thread:destroy-thread process)
+  #+sb-thread (sb-thread:destroy-thread process)
   #+lispworks (mp:process-kill process)
   )
 
@@ -32,7 +32,7 @@
   #+allegro (mp:make-process-lock :name name)
   #+cmu (mp:make-lock name)
   #+lispworks (mp:make-lock :name name)
-  #+sbcl-thread (sb-thread:make-mutex :name name)
+  #+sb-thread (sb-thread:make-mutex :name name)
   )
 
 (defmacro with-lock-held ((lock) &body body)
   `(mp:with-lock-held (,lock) ,@body)
   #+lispworks
   `(mp:with-lock (,lock) ,@body)
-  #+sbcl-thread
-  `(sb-thread:with-recursive-lock (,lock) ,@body)
+  #+sb-thread
+  `(sb-thread:with-mutex (,lock) ,@body)
+  #-(or allegro cmu lispworks sb-thread)
+  `(progn ,@body)
   )
 
 
+(defmacro with-timeout ((seconds) &body body)
+  #+allegro
+  `(mp:with-timeout (,seconds) ,@body)
+  #+cmu
+  `(mp:with-timeout (,seconds) ,@body)
+  #+sb-thread
+  `(sb-ext:with-timeout ,seconds ,@body)
+  #-(or allegro cmu sb-thread)
+  `(progn ,@body)
+  )
+  
+(defun process-sleep (n)
+  #+allegro (mp:process-sleep n)
+  #-allegro (sleep n))
+