#Merge cases#
Merge cases
In the consumer, you have two separate checks:
if ((seqno)-1 == count) { /* the message hasn't been completed yet */ _mm_pause(); continue; }
and later:
if (consumer_count > count) { /* we have incremented the consumer count enough to catch up to the producer */ _mm_pause(); continue; }
Since consumer_count
doesn't change in between those two blocks of code, you could move the second check up and merge it with the first one:
if ((seqno)-1 == count || consumer_count > count) {
/* the message hasn't been completed yet, or we have */
/* incremented the consumer count enough to catch up to the producer */
_mm_pause();
continue;
}
Moving the second check up could actually help you avoid dropping a packet that didn't need to be dropped.
#Merge cases#
In the consumer, you have two separate checks:
if ((seqno)-1 == count) { /* the message hasn't been completed yet */ _mm_pause(); continue; }
and later:
if (consumer_count > count) { /* we have incremented the consumer count enough to catch up to the producer */ _mm_pause(); continue; }
Since consumer_count
doesn't change in between those two blocks of code, you could move the second check up and merge it with the first one:
if ((seqno)-1 == count || consumer_count > count) {
/* the message hasn't been completed yet, or we have */
/* incremented the consumer count enough to catch up to the producer */
_mm_pause();
continue;
}
Moving the second check up could actually help you avoid dropping a packet that didn't need to be dropped.
Merge cases
In the consumer, you have two separate checks:
if ((seqno)-1 == count) { /* the message hasn't been completed yet */ _mm_pause(); continue; }
and later:
if (consumer_count > count) { /* we have incremented the consumer count enough to catch up to the producer */ _mm_pause(); continue; }
Since consumer_count
doesn't change in between those two blocks of code, you could move the second check up and merge it with the first one:
if ((seqno)-1 == count || consumer_count > count) {
/* the message hasn't been completed yet, or we have */
/* incremented the consumer count enough to catch up to the producer */
_mm_pause();
continue;
}
Moving the second check up could actually help you avoid dropping a packet that didn't need to be dropped.
#Merge cases#
In the consumer, you have two separate checks:
if ((seqno)-1 == count) { /* the message hasn't been completed yet */ _mm_pause(); continue; }
and later:
if (consumer_count > count) { /* we have incremented the consumer count enough to catch up to the producer */ _mm_pause(); continue; }
Since consumer_count
doesn't change in between those two blocks of code, you could move the second check up and merge it with the first one:
if ((seqno)-1 == count || consumer_count > count) {
/* the message hasn't been completed yet, or we have */
/* incremented the consumer count enough to catch up to the producer */
_mm_pause();
continue;
}
Moving the second check up could actually help you avoid dropping a packet that didn't need to be dropped.