View Single Post
Old 10 August 2021, 09:19   #23
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by Thomas Richter View Post
...and there you have it. Checked your code, you now have a race condition thanks to semaphores. First, what does the semaphore exactly protect? Anything it protects in LibOpen can go away without getting the semaphore in LibClose(), so it's not exactly helping, right?

Second, a task could remove your library while the semaphore is blocked. You need to increment the lib Open counter *outside* of the semaphore as this counter protects the library from going away *while* the semaphore is blocked.

Then, as said, you need to get LibClose() right to work with the semaphore.

As I said, avoid this... Think twice where a task could block, and what could happen in parallel while the semaphore is blocked.

ok - I removed that semaphore again ^^


btw: do you now if that freeing of the libraries memory is a leftover from old versions or should it be still there?
bebbo is offline  
 
Page generated in 0.05351 seconds with 10 queries