From: gavino
Subject: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <1166377859.510905.35530@l12g2000cwl.googlegroups.com>
is 'concurrency' supported in clisp or sbcl?

From: Pascal Costanza
Subject: Re: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <4ulgukF18qbgvU1@mid.individual.net>
gavino wrote:
> is 'concurrency' supported in clisp or sbcl?

Let's see:

This is SBCL 1.0, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* 'concurrency'

CONCURRENCY


Yes!


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Alex Mizrahi
Subject: Re: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <45858ef1$0$49204$14726298@news.sunsite.dk>
(message (Hello 'gavino)
(you :wrote  :on '(17 Dec 2006 09:50:59 -0800))
(

 g> is 'concurrency' supported in clisp or sbcl?

sbcl does.
on ABCL i've made an exec-parallel function, that can be used as:

(exec-parallel
  (loop for o in objects do collect (lambda () (process-object oo))
 4)

and it processes objects in 4 threads simultaneously. i've never programmed 
language as sisal, but i think that exec-parallel is already quite easy to 
use..

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"People who lust for the Feel of keys on their fingertips (c) Inity") 
From: Lars Rune Nøstdal
Subject: Re: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <pan.2006.12.17.22.29.22.943590@gmail.com>
On Sun, 17 Dec 2006 09:50:59 -0800, gavino wrote:

> is 'concurrency' supported in clisp or sbcl?

Yes, threads are supported in SBCL:

  (let ((output-mutex (makeMutex)))
    (dotimes (n 3) 
      (withThread n
        (sleep 1)
        (withMutex (output-mutex) (format t "~A says hello!~%" *current-thread*))))
    (write-line "Returns at once .."))
  Returns at once ..
  #<thread 0 {B4C6EF1}> says hello!
  #<thread 1 {B4C6F99}> says hello!
  #<thread 2 {B4C7041}> says hello!

..just some simple macros around the SBCL-thread API..

-- 
Lars Rune Nøstdal
http://nostdal.org/
From: ············@gmail.com
Subject: Re: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <1166413505.677304.221450@73g2000cwn.googlegroups.com>
Lars Rune Nostdal ¼g¹D¡G

> On Sun, 17 Dec 2006 09:50:59 -0800, gavino wrote:
>
> > is 'concurrency' supported in clisp or sbcl?
>
> Yes, threads are supported in SBCL:
>
>   (let ((output-mutex (makeMutex)))
>     (dotimes (n 3)
>       (withThread n
>         (sleep 1)
>         (withMutex (output-mutex) (format t "~A says hello!~%" *current-thread*))))
>     (write-line "Returns at once .."))
>   Returns at once ..
>   #<thread 0 {B4C6EF1}> says hello!
>   #<thread 1 {B4C6F99}> says hello!
>   #<thread 2 {B4C7041}> says hello!
>
> ..just some simple macros around the SBCL-thread API..
     I got this message and failed @@

debugger invoked on a UNDEFINED-FUNCTION: The function MAKEMUTEX is
undefined.
From: Lars Rune Nøstdal
Subject: Re: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <pan.2006.12.18.10.43.28.215554@gmail.com>
On Sun, 17 Dec 2006 19:45:05 -0800, ············@gmail.com wrote:

> 
> Lars Rune Nostdal 寫道:
> 
>> On Sun, 17 Dec 2006 09:50:59 -0800, gavino wrote:
>>
>> > is 'concurrency' supported in clisp or sbcl?
>>
>> Yes, threads are supported in SBCL:
>>
>>   (let ((output-mutex (makeMutex)))
>>     (dotimes (n 3)
>>       (withThread n
>>         (sleep 1)
>>         (withMutex (output-mutex) (format t "~A says hello!~%" *current-thread*))))
>>     (write-line "Returns at once .."))
>>   Returns at once ..
>>   #<thread 0 {B4C6EF1}> says hello!
>>   #<thread 1 {B4C6F99}> says hello!
>>   #<thread 2 {B4C7041}> says hello!
>>
>> ..just some simple macros around the SBCL-thread API..
>      I got this message and failed @@
> 
> debugger invoked on a UNDEFINED-FUNCTION: The function MAKEMUTEX is
> undefined.


(define-symbol-macro *current-thread*
    #+sbcl sb-thread:*current-thread*)



(defmacro makeMutex (&key (name nil name-supplied-p) (value nil value-supplied-p))
  (cond
    ((and name-supplied-p value-supplied-p)
     `(sb-thread:make-mutex :name ,name :value ,value))
    (name-supplied-p
     `(sb-thread:make-mutex :name ,name))
    (value-supplied-p
     `(sb-thread:make-mutex :value ,value))
    (t
     `(sb-thread:make-mutex))))



(defmacro withMutex ((mutex &key new-value (wait-p t)) &body body)
  "Acquire `mutex' for the dynamic scope of `body', setting it to
`new-value' or some suitable default value if NIL.  If `wait-p' is non-NIL
and the mutex is in use, sleep until it is available" 
  `(sb-thread:with-mutex (,mutex :value ,new-value :wait-p ,wait-p)
     ,@body))



(defmacro withThread (name &body body)
  "Defines a thread that executes `body'. Returns the thread-instance."
  (let ((st (gensym)))
    `(let ((,st *standard-output*))
       (sb-thread:make-thread
        (lambda ()
          (let ((*standard-output* ,st))
            ,@body))
        :name ,name))))



(defun test ()
  (let ((output-mutex (makeMutex)))
    (dotimes (n 3) 
      (withThread n
        (sleep 1)
        (withMutex (output-mutex) (format t "~A says hello!~%" *current-thread*))))
    (write-line "Returns at once ..")))

-- 
Lars Rune Nøstdal
http://nostdal.org/
From: ············@gmail.com
Subject: Re: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <1166455461.695733.258590@79g2000cws.googlegroups.com>
Thanks for the answer
From: gavino
Subject: Re: http://sisal.sourceforge.net/ is sisal alive at all? any lisp library do things like concurrency?
Date: 
Message-ID: <1166471002.775211.68800@l12g2000cwl.googlegroups.com>
so concurrency is completely supported? wow