Skip to content

Support atomic queue operations #131

Description

@Qvorvm

I have a JContainers fork where I added:
pullInt( array, default = 0) returns int
pullFlt( array, default = 0.0) returns float
pullForm( array, default = None) returns Form
pullObj( array, default = 0) returns int
pullStr( array, default = "") returns string

They combine get*( array, 0) and eraseIndex( array, 0) into a single operation to simplify concurrent queue worker implementations.
If the array is empty, or if the first item's type does not match, it returns the default value without modifying the array.

I also upgraded the code to Boost 1.91.0.

While I was doing this, I also noted there are a few places where the code acquires a 2nd object_lock (because the operation involves two arrays or maps). I'm now thinking this could cause CTDs when two threads try these operations on the same two objects but in a different order, like:
thread1: JArray.addAll( array1, array2)
thread2: JArray.addAll( array2, array1)
It might explain some random crashes I've been getting (even though I don't think I'm doing anything this stupid in my own code, though I might when I mix in some JValue.deepCopy calls).

Let me know how I should proceed with my pull* branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions