From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30806 invoked by alias); 5 Apr 2006 13:14:49 -0000 Received: (qmail 30797 invoked by uid 22791); 5 Apr 2006 13:14:48 -0000 X-Spam-Check-By: sourceware.org Received: from f64.mail.ru (HELO f64.mail.ru) (194.67.57.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 05 Apr 2006 13:14:46 +0000 Received: from mail by f64.mail.ru with local id 1FR7qN-000KCn-00 for ecos-discuss@ecos.sourceware.org; Wed, 05 Apr 2006 17:14:43 +0400 Received: from [81.28.2.164] by win.mail.ru with HTTP; Wed, 05 Apr 2006 17:14:43 +0400 From: Gennady Mavrin To: ecos-discuss@ecos.sourceware.org Mime-Version: 1.0 Date: Wed, 05 Apr 2006 13:14:00 -0000 Reply-To: Gennady Mavrin 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: Re: [ECOS] problem with select() X-SW-Source: 2006-04/txt/msg00044.txt.bz2 >> 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? > I don't believe it's correct to lock the scheduler multiple times (in > the loop) and then unlock it only once. It's my mistake. I have changed the structure of cyg_pselect() function as follow: int cyg_pselect( ) { ... Cyg_Scheduler::lock(); while (!error) { for (mode = 0; !error && mode < 3; mode++) { ... // Checking the descriptors to be ready to requested operation ... } ... // Waiting for cyg_selwakeup() call ... } Cyg_Scheduler::unlock(); } I am not sure that it's a good solution but now select( ) function works fine from my point of view. 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