delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/19/13:03:45

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3E020B55.5000101@netcom.es>
Date: Thu, 19 Dec 2002 18:09:25 +0000
From: Ignasi Villagrasa <gri AT netcom DOT es>
Organization: gri
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1
X-Accept-Language: es-es
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: try/catch and mutithreading

Hi everyone,

I've got a problem migrating several C++ based server applications from 
Watcom 10.5 compiler to cygwin. The problem arises when diferent threads 
get into a try/catch block concurrently. Then cygwin forces me to 
include a semaphore out of try block to solve a concurrency conflict 
that I didn't have using Watcom 10.5, or I don't have now only avoiding 
the try/catch structure.

Source code

void A()
{

MySemaphore.Request();

try
{




}
catch(...)
{


}
catch(...)
{


}

MySemaphore.Release() ;

return;
}

works properly in multithreading, but

void A()
{


try
{
MySemaphore.Request();



}
catch(...)
{


}
catch(...)
{


}

MySemaphore.Release() ;

return;
}

gives me a concurrent problem.

Obviously without semaphores I get a concurrency error also.

I use here the semaphore in order to investigate where in the code the 
problem arises. Normally I cannot use it because of performance problem.


Here is Cygwin version I'm using:

cygwin  1.3.12-2
gcc                 2.95.3-5
gcc-mingw           3_1-20020516-1


I don't use pthreads emulation in order to maintain compatibility to 
previos versions. So I'm using for multithreading _beginthreadex familly 
funtions, the same that work using Watcom.

Could anyone give me a hint ?

Thanks in advance, Ignasi Villagrasa. GRI S.L.






--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019