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

Implement push! #26

Closed
bryaan opened this issue Jun 6, 2023 · 1 comment
Closed

Implement push! #26

bryaan opened this issue Jun 6, 2023 · 1 comment

Comments

@bryaan
Copy link

bryaan commented Jun 6, 2023

Can we add something like this?

function Base.push!(data::Lockable{Vector{T},ReentrantLock}, elements) where {T}
    lock(data) do vec
        push!(vec, elements)
    end
end
@quinnj
Copy link
Member

quinnj commented Jun 9, 2023

I don't think it's really necessary. While not strict type piracy, this is generally considered "type light robbbery" in that we (the ConcurrentUtilities.jl) package don't own the Vector type, so we shouldn't be overloading for it.

But the bigger reason is that it's so little code, it just doesn't seem worth it to "hide" the fact that your Lockable{Vector} is actually a Lockable instead of a Vector.

@quinnj quinnj closed this as completed Jun 9, 2023
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

2 participants