new connection request is ready for processing, an object is placed on
the CR list, and data is written to the internal socket. The write causes
the CR thread to wake-up and process anything on its cr list.
If multiple objects are placed on the CR list around the same time, then
the CR thread will read in a single character, but process the entire list.
This results in additional data being left on the internal socket. When
the CR does a select(), it will find more data to read, read the data, but
not have any real work to do. The result is that the thread spins in a
loop checking for changes when none have occurred until all data on the
internal socket has been read.
Avoid this overhead by reading all data off the internal socket before
processing the CR list.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
dapl_select(set);
/* if pipe used to wakeup, consume */
- if (dapl_poll(g_scm[0], DAPL_FD_READ) == DAPL_FD_READ) {
+ while (dapl_poll(g_scm[0], DAPL_FD_READ) == DAPL_FD_READ) {
if (recv(g_scm[0], rbuf, 2, 0) == -1)
dapl_log(DAPL_DBG_TYPE_CM,
" cr_thread: read pipe error = %s\n",