- if (FD_ISSET (i, &fdset_tcl_r))
- {
- if (callback_table[i].r_handle)
- (*callback_table[i].r_handle) (callback_table[i].obj);
- }
- if (FD_ISSET (i, &fdset_tcl_w))
- {
- if (callback_table[i].w_handle)
- (*callback_table[i].w_handle) (callback_table[i].obj);
- }
- if (FD_ISSET (i, &fdset_tcl_x))
- {
- if (callback_table[i].x_handle)
- (*callback_table[i].x_handle) (callback_table[i].obj);
- }
+ int r_flag = 0;
+ int w_flag = 0;
+ int e_flag = 0;
+
+ if (!callback_table[i].handle)
+ continue;
+ if (FD_ISSET (i, &fdset_tcl_r) && callback_table[i].r)
+ r_flag = 1;
+ if (FD_ISSET (i, &fdset_tcl_w) && callback_table[i].w)
+ w_flag = 1;
+ if (FD_ISSET (i, &fdset_tcl_x) && callback_table[i].e)
+ e_flag = 1;
+ if (r_flag || w_flag || e_flag)
+ (*callback_table[i].handle)(callback_table[i].obj,
+ r_flag, w_flag, e_flag);