1
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: modlisp -*-
2
;;;; *************************************************************************
3
;;;; FILE IDENTIFICATION
5
;;;; Name: processes.lisp
6
;;;; Purpose: Multiprocessing functions
7
;;;; Programmer: Kevin M. Rosenberg
8
;;;; Date Started: June 2003
10
;;;; $Id: processes.lisp 8573 2004-01-29 23:30:50Z kevin $
11
;;;; *************************************************************************
16
(defun make-process (name func)
17
#+allegro (mp:process-run-function name func)
18
#+cmu (mp:make-process func :name name)
19
#+lispworks (mp:process-run-function name nil func)
20
#+sb-thread (sb-thread:make-thread func)
21
#-(or allegro cmu lispworks sb-thread) (funcall func)
24
(defun destroy-process (process)
25
#+cmu (mp:destroy-process process)
26
#+allegro (mp:process-kill process)
27
#+sb-thread (sb-thread:destroy-thread process)
28
#+lispworks (mp:process-kill process)
31
(defun make-lock (name)
32
#+allegro (mp:make-process-lock :name name)
33
#+cmu (mp:make-lock name)
34
#+lispworks (mp:make-lock :name name)
35
#+sb-thread (sb-thread:make-mutex :name name)
38
(defmacro with-lock-held ((lock) &body body)
40
`(mp:with-process-lock (,lock) ,@body)
42
`(mp:with-lock-held (,lock) ,@body)
44
`(mp:with-lock (,lock) ,@body)
46
`(sb-thread:with-recursive-lock (,lock) ,@body)
47
#-(or allegro cmu lispworks sb-thread)
52
(defmacro with-timeout ((seconds) &body body)
54
`(mp:with-timeout (,seconds) ,@body)
56
`(mp:with-timeout (,seconds) ,@body)
58
`(sb-ext:with-timeout ,seconds ,@body)
59
#-(or allegro cmu sb-thread)
63
(defun process-sleep (n)
64
#+allegro (mp:process-sleep n)