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

A copy of a concurrent bounded queue object doesn't preserve capacity of the original object #1598

Open
SergueiEK opened this issue Jan 11, 2025 · 0 comments
Labels

Comments

@SergueiEK
Copy link

Summary

A copy of a concurrent bounded queue doesn't preserve capacity of the original queue object.

Version

2021.10.0

Environment

gcc 13.1.0

Observed Behavior

If I set capacity to an instance of concurrent bounded queue and then make a copy of this queue, capacity of the copied object is set to the default value (0x3fffffffffffffff)

Expected Behavior

I would expect the copy of the queue having the same capacity as the original one.

Steps To Reproduce

The following code can be used to reproduce the issue:

#include <iostream>
#include <tbb/concurrent_queue.h>
int main(int ac, char**av) {
    tbb::concurrent_bounded_queue<int> q;
    q.set_capacity(100);
    std::cout << "q capacity = " << q.capacity() << std::endl;
    tbb::concurrent_bounded_queue<int> q2(q);
    std::cout << "q capacity = " << q.capacity() << " q2 capasity = " << q2.capacity() << std::endl;
}

It produces the following output:

q capacity = 100
q capacity = 100 q2 capasity = 4611686018427387903
@SergueiEK SergueiEK added the bug label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant