Relative Content

Tag Archive for c#multithreading

Reliably checking if a thread can be created [duplicate]

This question already exists: Reliably checking if the OS can spawn a thread [closed] Closed 4 days ago. EDIT: Having figured it out (see my own answer), I get that the question text below is misleading, which caused a lot of misunderstanding. I still believe it might help somebody who has the same issue. Justification […]

Multithreading slows down loop

I realize there are a lot of questions asking why multithreading can slowdown a program but it always seems to come down to threads aggressively locking shared state. In my case I’m not using any locks.

Multithreading slows down loop

I realize there are a lot of questions asking why multithreading can slowdown a program but it always seems to come down to threads aggressively locking shared state. In my case I’m not using any locks.

Why is push thread running until the queue reaches its max size? Why is it not like – push, pop, push, pop?

I’m trying to learn threading in C++ and not able to understand why both threads are not running one after the other? After push, the mutex is unlocked and notified through condition variable.
Why is pop thread not executing at the point? It can access the queue as the mutex is unlocked and pop the inserted value. But instead what I’m seeing is that push thread runs till the queue is full and after that pop thread runs till the queue is empty.