Does using a lock has better performance than using a local (single application) semaphore?
I read this blog from msdn : Producer consumer solution on msdn
and i didn't like their solution to the problem because there are always 20 elements left in the queue.
So instead, i thought about using a Semaphore
that will be available only in my app (i just won't name it in the constructor), but i don't know how it will effect the app's performance.
Any one has an idea if it'll hurt the performance? what are the other considerations to use lock and not Semaphore
?
tnx!