Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16624

Partially deleting elements from a bytearray while adding to it from another thread

$
0
0

I have bytearray object, two threads are accessing it, a producer and consumer.

The producer writes to the bytearray: barr.extend(data)

The consumer reads from the bytearray: barr.find(...), barr[x:y]

The producer adds alot of data to the bytearray so I want to free up memory occasionally by del barr[:last_read_pos]

Is this operation thread safe?

Thanks.


Viewing all articles
Browse latest Browse all 16624

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>