Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
jjacksonRIAB is currently offline  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.

 
Read Message
Read Message
Read Message
Previous Topic: code to more than one database and your threads
Next Topic: httprequest fails getting entire url content
Goto Forum:
  


Current Time: Fri Apr 26 23:58:46 CEST 2024

Total time taken to generate the page: 2.93080 seconds