Skip to content

Commit 119f399

Browse files
authored
Update README.md
1 parent 98722ba commit 119f399

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,18 @@ d.update_atomic("x", lambda v: v + 1) # d now contains 2 under the 'x' key.
110110
```
111111

112112
### ConcurrentQueue
113+
For thread-safe queues, Python offers already a lot of alternatives, even too many, so I'm not going to add another. Please refer to the following:
114+
In the [`queue`](https://docs.python.org/3/library/queue.html) module:
115+
- `queue`,
116+
- `LifoQueue`,
117+
- `PriorityQueue`
118+
- `SimpleQueue`.
113119

114-
A thread-safe double-ended queue.
120+
Note these queue collections are thread-safe, although it isn't explicitly clear from their type name, making it **dangerously confusing** for people mistaking the same property to apply to e.g. [`deque`](https://docs.python.org/3/library/collections.html#collections.deque), which is absolutely **not** thread-safe.
121+
122+
Additionally, there are [other queues classes in the `multiprocessing` module](https://docs.python.org/3/library/multiprocessing.html#pipes-and-queues), which makes it even more confusing due to the redundancy with the above queue classes.
115123

116-
```python
117-
from concurrent_collections import ConcurrentQueue
118124

119-
q = ConcurrentQueue()
120-
q.append(1)
121-
q.appendleft(0)
122-
print(q.pop()) # 1
123-
print(q.popleft()) # 0
124-
```
125125

126126
## License
127127

0 commit comments

Comments
 (0)