Sophie Hu wrote:
> It seems that all of you are expert at port and select(). Let me ask another 
> question: Actually I found sth. strange when I use port_get(). I am not sure 
> if it is a bug of port_getn() or if it is due to my code. just FYI in case 
> you used to have the same problem or you are interested in doing some 
> analysis.
>
> after I return from port_getn(), if I reassoociate the sock using 
> port_associate() immediately after i return from port_getn(), then next time 
> the event which is available last time will be available again. 
>
>   
You have to reassociate  after processing the event. For ex. in this 
case after the accept() call on the
socket listen_socket. Otherwise the event will get delivered again.

> for example, when I get port_getn() which shows that listen_socket is ready 
> to accept a new read_sock, then next time when I get port_getn(), I get both 
> listen_socket to  ready to accept (although there is nothing to accept) and 
> read_sock for reading data.
>
> when I get port_getn() which shows that read_socket is ready to read data, 
> then next time when I get port_getn(), I get event which shows the same 
> read_sock is ready to read data (although there is nothing to read).
>
> However, if I re-associate all interested ports in front of port_getn(), the 
> strange thing does not happen.
>   
Note,  unlike poll or select you need to only re-associate the file 
descriptors  for which events
are received not all the file descriptors that you are interested in.

-Prakash.
>  
>  
> This message posted from opensolaris.org
> _______________________________________________
> perf-discuss mailing list
> perf-discuss@opensolaris.org
>   

_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to