From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15607 invoked by alias); 2 Apr 2006 15:01:19 -0000 Received: (qmail 15598 invoked by uid 22791); 2 Apr 2006 15:01:18 -0000 X-Spam-Check-By: sourceware.org Received: from f25.mail.ru (HELO f25.mail.ru) (194.67.57.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 02 Apr 2006 15:01:17 +0000 Received: from mail by f25.mail.ru with local id 1FQ44p-0001Qm-00 for ecos-discuss@ecos.sourceware.org; Sun, 02 Apr 2006 19:01:15 +0400 Received: from [212.45.31.170] by win.mail.ru with HTTP; Sun, 02 Apr 2006 19:01:15 +0400 From: =?koi8-r?Q?=ED=C1=D7=D2=C9=CE=20=E7=C5=CE=CE=C1=C4=C9=CA?= To: ecos-discuss@ecos.sourceware.org Mime-Version: 1.0 Date: Sun, 02 Apr 2006 15:01:00 -0000 Reply-To: =?koi8-r?Q?=ED=C1=D7=D2=C9=CE=20=E7=C5=CE=CE=C1=C4=C9=CA?= Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit Message-Id: Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] problem with select() X-SW-Source: 2006-04/txt/msg00002.txt.bz2 I use the old version of ecos (ecos 2.0 downloaded at December 2003). But I searched the problem I have in the ecos bug tracking database and didn't find it. I use select() function to wait when the descriptor will be ready for reading. Sometime select() returns 0 (time limit expire) but I am sure that the requested descriptor was ready for reading some time ago. After that if I perform the reading operation with this descriptor it completes successfully. I think that I know the reason of this problem. The structure of cyg_pselect() function is: int cyg_pselect( ) { while (!error) { for (mode = 0; !error && mode < 3; mode++) { ... // Checking the descriptors to be ready to requested operation ... } ... Cyg_Scheduler::lock(); ... // Waiting for cyg_selwakeup() call ... Cyg_Scheduler::unlock(); } } I think that the descriptor may come ready after the loop which checks the descriptors to be ready to requested operation but before Cyg_Scheduler::lock() function call. In this case cyg_pselect( ) will wait for descriptor even if this descriptor is ready. My idea is to move Cyg_Scheduler::lock() call up. int cyg_pselect( ) { while (!error) { for (mode = 0; !error && mode < 3; mode++) { Cyg_Scheduler::lock(); ... // Checking the descriptors to be ready to requested operation ... } ... // Waiting for cyg_selwakeup() call ... Cyg_Scheduler::unlock(); } } Is my idea good or not? Gennady -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss