138 | | if (m_type==eTT_Transmit) { |
---|
139 | | // if we are a transmit thread, we should only poll on |
---|
140 | | // those handlers that have a client that is ready to send |
---|
141 | | // something. poll'ing the others will only cause busy-wait |
---|
142 | | // looping. |
---|
143 | | for (i = 0; i < m_poll_nfds_shadow; i++) { |
---|
144 | | short events = 0; |
---|
145 | | if (m_IsoHandler_map_shadow[i]->tryWaitForClient()) { |
---|
146 | | events = POLLIN | POLLPRI; |
---|
| 138 | // we should prevent a poll() where no events are specified, since that will only time-out |
---|
| 139 | bool no_one_to_poll = true; |
---|
| 140 | while(no_one_to_poll) { |
---|
| 141 | if (m_type==eTT_Transmit) { |
---|
| 142 | // if we are a transmit thread, we should only poll on |
---|
| 143 | // those handlers that have a client that is ready to send |
---|
| 144 | // something. poll'ing the others will only cause busy-wait |
---|
| 145 | // looping. |
---|
| 146 | for (i = 0; i < m_poll_nfds_shadow; i++) { |
---|
| 147 | short events = 0; |
---|
| 148 | if (m_IsoHandler_map_shadow[i]->tryWaitForClient()) { |
---|
| 149 | events = POLLIN | POLLPRI; |
---|
| 150 | no_one_to_poll = false; |
---|
| 151 | } |
---|
| 152 | m_poll_fds_shadow[i].events = events; |
---|
148 | | m_poll_fds_shadow[i].events = events; |
---|
149 | | } |
---|
150 | | } else { |
---|
151 | | // for receive handlers, we can do the same. we might not have to though |
---|
152 | | // FIXME: check whether this is necessary |
---|
153 | | for (i = 0; i < m_poll_nfds_shadow; i++) { |
---|
154 | | short events = 0; |
---|
155 | | // if (m_IsoHandler_map_shadow[i]->tryWaitForClient()) { |
---|
156 | | // events = POLLIN | POLLERR | POLLHUP; |
---|
157 | | // } |
---|
158 | | events = POLLIN | POLLPRI; |
---|
159 | | m_poll_fds_shadow[i].events = events; |
---|
| 154 | } else { |
---|
| 155 | // for receive handlers, we can do the same. we might not have to though |
---|
| 156 | for (i = 0; i < m_poll_nfds_shadow; i++) { |
---|
| 157 | short events = 0; |
---|
| 158 | if (m_IsoHandler_map_shadow[i]->tryWaitForClient()) { |
---|
| 159 | events = POLLIN | POLLERR | POLLHUP; |
---|
| 160 | no_one_to_poll = false; |
---|
| 161 | } |
---|
| 162 | m_poll_fds_shadow[i].events = events; |
---|
| 163 | } |
---|
| 164 | } |
---|
| 165 | if(no_one_to_poll) { |
---|
| 166 | debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, |
---|
| 167 | "(%p, %8s) No one to poll, waiting on the first handler to become ready\n", |
---|
| 168 | this, m_type==eTT_Transmit?"Transmit":"Receive"); |
---|
| 169 | |
---|
| 170 | m_IsoHandler_map_shadow[0]->waitForClient(); |
---|
| 171 | |
---|
| 172 | debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, |
---|
| 173 | "(%p, %8s) handler ready\n", |
---|
| 174 | this, m_type==eTT_Transmit?"Transmit":"Receive"); |
---|