Hi,
I am trying to create two threads using the pthread library.
Both threads have the same attributes and do the same thing (they are both listening to UDP port and waiting for messages).
The issue here is that one of the thread (the one created last) is a lot slower than the other. (when I send a message to the second thread it takes longer to process it than when I send it to the first one created).
Here are the attributes I use for the threads:
Any idea of what I may do wrong?
Thanks
I am trying to create two threads using the pthread library.
Both threads have the same attributes and do the same thing (they are both listening to UDP port and waiting for messages).
The issue here is that one of the thread (the one created last) is a lot slower than the other. (when I send a message to the second thread it takes longer to process it than when I send it to the first one created).
Here are the attributes I use for the threads:
Code:
pthread_attr_init(&custom_attributes);
pthread_attr_setscope(&custom_attributes, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setinheritsched(&custom_attributes, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&custom_attributes, SCHED_RR);
rr_param.sched_priority = sched_get_priority_max(SCHED_RR);
pthread_attr_setschedparam(&custom_attributes,&rr_param);
Any idea of what I may do wrong?
Thanks