Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
leetwinski opened this issue May 31, 2024 · 0 comments

Comments

@leetwinski
Copy link

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 🥲

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant