Quote Originally Posted by stolencoin View Post
*sigh* I wish people showed this much interest to my intellisense thread
This thread is more interesting than trying to figure out why intellisense doesn't work in a 7 year old environment.

Quote Originally Posted by stolencoin View Post
I'm not trying to prevent the same thread entering the critical section recursively. I know it was designed that way. I'm trying to prevent it (especially the producer) to enter the CS ten times in a row.
My point is that if you need different behavior from what a critical section can do, then you need to use a different synchronization object. A cs can't limit a thread to a specific number of locks in a row.

Quote Originally Posted by stolencoin View Post
And I'm not happy about polling either. But I'm using select() in the consumer thread and to set the writefds I need to see if there is something in the buffer, and to do that I need to return from select once in a while (hence maybe not polling frequent enough).
Polling just seems like a waste of resources when the consuming thread could wait for an event.

Quote Originally Posted by stolencoin View Post
Producer allocating memory and enqueuing, consumer dequeueing and freeing memory will work I guess. With the additional penalty of allocating-deallocating memory.
Yes, but unless you have some very high speed requirements, using a queue probably won't be a performance bottleneck. You'll have to decide on that, but a queue sure would simplify the code.

Quote Originally Posted by stolencoin View Post
And it looks like noone wants to touch fibers.
No one wants to touch fibers because we don't think they'll help.