87
C# Threading Example: ThreadPriority
Let’s see an example where we are changing the priority of the thread. The high priority thread can be executed first. But it is not guaranteed because thread is highly system dependent. It increases the chance of the high priority thread to execute before low priority thread.
Output:
The output is unpredictable because threads are highly system dependent. It may follow any algorithm preemptive or non-preemptive.
Player1 is running Player3 is running Player2 is running
Next TopicC# Thread Synchronization