GithubHelp home page GithubHelp logo

sharplispers / lparallel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lmj/lparallel

13.0 13.0 5.0 1.11 MB

Parallelism for Common Lisp

Home Page: http://lparallel.org

License: BSD 3-Clause "New" or "Revised" License

Common Lisp 99.85% Shell 0.15%

lparallel's People

Contributors

dkochmanski avatar fare avatar leetwinski avatar lmj avatar scymtym avatar sionescu avatar ska80 avatar stassats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lparallel's Issues

END-KERNEL isn't sufficient to avoid a thread-join race

The current implementation of END-KERNEL isn't sufficient - the threads are not necessarily gone when that function returns.

I'm doing something akin to

  (let (...
        (lparallel:*kernel* (lparallel:make-kernel 4)))
    (format t "Loading...~%")
    (lparallel:pmap nil 
                    (lambda (file)
                      (import-file ...))
                    ...)
    (lparallel:end-kernel :wait t))
  (save-lisp-and-die ...)

but that (sometimes) breaks with

debugger invoked on a SB-IMPL::SAVE-WITH-MULTIPLE-THREADS-ERROR in thread
#<THREAD tid=3161136 "main thread" RUNNING {1003848003}>:
  Cannot save core with multiple threads running.

  Interactive thread (of current session):
    #<THREAD tid=3161136 "main thread" RUNNING {1003848003}>

  Other thread:
    #<THREAD "lparallel" FINISHED values: NIL {1069E88B23}>
See also:
  The SBCL Manual, Node "Saving a Core Image"

What does seem to help is to use

    (map 'nil
         #'sb-thread:join-thread
         (lparallel:end-kernel :wait t))))

but I guess that should be done in lparallel proper?!

Thanks!

lparallel / stmx interop gets broken after lparallel update to bordeaux-threads2

Hello!
I've found out that stmx integration got broken after lparallel bt2 migration (the latest functional lparallel commit was 80fc2952a074776abd343d6b5d3ab157f0e1df7a)

Does anyone have any idea on fixing that?
Thought that simply switching bt to api v2 in stmx source code would help, but it doesn't seem to be that straightforward.

minimal reproduceable example:

(deftype unsigned-fixnum () '(integer 0 #.most-positive-fixnum))

(stmx:transactional
    (defclass account ()
      ((balance :initform 0  :initarg :balance  :type unsigned-fixnum :accessor account-balance)
       (name    :initform "" :initarg :name     :type string          :reader   account-name
                :transactional nil))))

(defun future-stm ()
  (let* ((lparallel:*kernel* (lparallel:make-kernel 4))
         (acc (make-instance 'account :name "Mario rossi" :balance 1000)))
    (dotimes (i 10) (lparallel:force
                     (lparallel:future
                       (stmx:atomic
                        (when (>= (account-balance acc) 1)
                          (decf (account-balance acc) 1)
                          t))
                       )))))

that works fine before 80fc2952a074776abd343d6b5d3ab157f0e1df7a, but fails with
(FORMAT NIL "stmx:*current-thread* contains a stale value:~& found ~S~& expecting ~S" #<BT2:THREAD "main thread" {1004AFD8C3}> #<BT2:THREAD "lparallel" {10039C5CD3}>) afterwards.

@sionescu, maybe you can help here? since you're the expert in bt obviously 🥲

TASK-HANDLER-BIND does not accept compound type specifiers

Original issue: lmj#34

Report:

The documentation string of task-handler-bind claims that it works like handler-bind but it actually only accepts symbols as condition type specifiers:

(lparallel:task-handler-bind (((and error (not undefined-function)) #'continue)) …)
=> Ill-formed binding in `task-handler-bind': ((AND ERROR (NOT UNDEFINED-FUNCTION)) #'CONTINUE)

Discussion:
none

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.