Typedef struct {
string name;//user name
Unint8_t priority;//user preferences
} my_st;
There are two list
List
{there is a process with two threads,
Thread 1: per second statement a my_st obj, and myList. Push_back (obj);
Thread 2: iterates myList, whether to have elements that have, according to the priority queue (insert myOkList priority level from high to low) and remove the element from the myList, into the next loop through,
Note: have the lock to ensure exclusive access between the two threads,
}
Question: thread 2 how to implement according to the priority queue (insert myOkList priority level from high to low)?
CodePudding user response:
Have been implemented, with the list: : sort (func)!