Home » U++ Library support » U++ MT-multithreading and servers » Segfault while using BiVector (Locking is too slow, suggestions?)
Segfault while using BiVector [message #56721] |
Tue, 06 April 2021 19:51 |
jjacksonRIAB
Messages: 220 Registered: June 2011
|
Experienced Member |
|
|
I'm using a BiVector as a multimedia queue. I'm a noob as far as this stuff is concerned but what happens is I have a frame of audio/video that serves as a wrapper. Anyway I found out rather quickly that I can't use item& AddHead() method on BiVector because another thread will see it's inserted but not fully initialized and then try to dereference a null pointer. So I construct it, initialize it first and then insert it using pick, taking care that I set the prior reference to nullptr after the move so it won't try to delete it at the end of the loop.
Problem is it still seems to be doing it even when I do AddHead(item&&). I have been able to make it work using INTERLOCK but the demands on the queue are so high that it never fills up beyond one item with the locking added and I end up dropping many frames. I haven't looked at the code for BiVector yet (so forgive me if I'm wrong) but from the behavior I'm indirectly observing the container count seems to increment before the container actually "owns" the data unless I'm doing something wrong - which is probably more likely.
|
|
|
|
|
Goto Forum:
Current Time: Fri Apr 19 05:04:38 CEST 2024
Total time taken to generate the page: 0.06131 seconds
|