Priority - ZjzMisaka/PowerThreadPool GitHub Wiki
WorkPriority
WorkPriority signifies the priority level of the works that needs to be undertaken.
Works with a higher WorkPriority are executed earlier than those with a lower priority. This facilitates a more efficient and organized execution of works, particularly in situations where certain works are more critical or time-sensitive than others. By setting the WorkPriority, the order and speed of work execution in the applications can be effectively controlled.
powerPool.QueueWorkItem(() =>
{
// Do something
}, new WorkOption()
{
WorkPriority = 2
});
ThreadPriority
ThreadPriority pecifies the scheduling priority of a System.Threading.Thread.
However, handling this attribute requires a degree of caution. Modifying the ThreadPriority could potentially lead to problems such as thread starvation or priority inversion, which could detrimentally affect the application's performance or even cause it to become unresponsive. Therefore, it is important to tread carefully while setting the ThreadPriority, ensuring its implications are thoroughly understood.
powerPool.QueueWorkItem(() =>
{
// Do something
}, new WorkOption()
{
ThreadPriority = ThreadPriority.Highest
});