This file is indexed.

/usr/share/common-lisp/source/mcclim/Lisp-Dep/mp-openmcl.lisp is in cl-mcclim 0.9.6.dfsg.cvs20100315-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: CLIM-INTERNALS; -*-
;;; ---------------------------------------------------------------------------
;;;     Title: CLIM-2, Chapter 32.2 Multi-processing
;;;            for ACL
;;;   Created: 2001-05-22
;;;    Author: Gilbert Baumann <unk6@rz.uni-karlsruhe.de>
;;;   License: LGPL (See file COPYING for details).
;;; ---------------------------------------------------------------------------
;;;  (c) copyright 2001 by Gilbert Baumann
;;;  (c) copyright 2002 by John Wiseman (jjwiseman@yahoo.com)

;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Library General Public
;;; License as published by the Free Software Foundation; either
;;; version 2 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;; Library General Public License for more details.
;;;
;;; You should have received a copy of the GNU Library General Public
;;; License along with this library; if not, write to the 
;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
;;; Boston, MA  02111-1307  USA.

(in-package :CLIM-INTERNALS)

(defconstant *multiprocessing-p* t)

(eval-when (:load-toplevel :compile-toplevel :execute)
  (pushnew :clim-mp *features*))

(defun make-process (function &key name)
  (ccl:process-run-function name function))

(defun destroy-process (process)
  (ccl:process-kill process))

(defun current-process ()
  ccl:*current-process*)

(defun all-processes ()
  #-openmcl-native-threads
  ccl:*all-processes*
  #+openmcl-native-threads
  (ccl:all-processes))

(defun processp (object)
  (typep object 'ccl::process))

(defun process-name (process)
  (ccl:process-name process))

(defun process-state (process)
  (declare (ignore process))
  ;; Hmm can we somehow gain useful information here?
  nil)

(defun process-whostate (process)
  (ccl:process-whostate process))

(defun process-wait (reason predicate)
  (ccl:process-wait reason predicate))

(defun process-wait-with-timeout (reason timeout predicate)
  (ccl:process-wait-with-timeout reason timeout predicate))

(defun process-yield ()
  (ccl:process-allow-schedule))

(defun process-interrupt (process function)
  (ccl:process-interrupt process function))

(defun disable-process (process)
  #-openmcl-native-threads
  (ccl:process-enable-arrest-reason process 'suspend)
  #+openmcl-native-threads
  (ccl:process-suspend process))

(defun enable-process (process)
  #-openmcl-native-threads
  (ccl:process-disable-arrest-reason process 'suspend)
  #+openmcl-native-threads
  (ccl:process-enable process))


(defun restart-process (process)
  (ccl:process-reset process) )

(defmacro without-scheduling (&body body)
  `(ccl:without-interrupts ,@body))

;; We perhaps could make use of EXCL::ATOMICALLY, which is
;; undocumented, but seems to do what we want.
;; Use EXCL::ATOMICALLY in OpenMCL?? - mikemac

#-openmcl-native-threads
(defmacro atomic-incf (place)
  `(ccl:without-interrupts
    (incf (the fixnum ,place))))

#-openmcl-native-threads
(defmacro atomic-decf (place)
  `(ccl:without-interrupts
    (decf (the fixnum ,place))))

#+openmcl-native-threads
(defmacro atomic-incf (place)
  `(ccl::atomic-incf ,place))

#+openmcl-native-threads
(defmacro atomic-decf (place)
  `(ccl::atomic-decf ,place))
      

;;; 32.3 Locks

(defun make-lock (&optional name)
  (ccl:make-lock name))

(defmacro with-lock-held ((place &optional state) &body body)
  #-openmcl-native-threads
  `(ccl:with-lock-grabbed (,place 'ccl:*current-process*
				  ,@(if state (list state) nil))
			  ,@body)
  #+openmcl-native-threads
  `(ccl:with-lock-grabbed (,place  ,@(if state (list state) nil))
    ,@body))

(defun make-recursive-lock (&optional name)
  (ccl:make-lock name))

(defmacro with-recursive-lock-held ((place &optional state) &body body)
  `(with-lock-held (,place   ,@(if state (list state) nil)) ,@body))

;;; Condition variable simulation

(defun make-condition-variable () (ccl:make-semaphore))

(defun condition-wait (cv lock &optional timeout)
  (let ((lock-error nil))
    (unwind-protect
	 (progn
	   (handler-bind
	       ((ccl::lock-not-owner #'(lambda (c)
					 (declare (ignore c))
					 (setq lock-error t))))
	     (ccl:release-lock lock))
	   (if timeout
	       (ccl:timed-wait-on-semaphore cv timeout)
	       (ccl:wait-on-semaphore cv))) ;XXX nil here is some kind of error
      (unless lock-error       ; We didn't have the lock.
	(ccl:grab-lock lock)))))

(defun condition-notify (cv)
  (ccl:signal-semaphore cv))