From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26079 invoked by alias); 20 Oct 2003 15:40:34 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 26069 invoked from network); 20 Oct 2003 15:40:33 -0000 Received: from unknown (HELO crufty.research.bell-labs.com) (204.178.16.49) by sources.redhat.com with SMTP; 20 Oct 2003 15:40:33 -0000 Received: from grubby.research.bell-labs.com (H-135-104-2-9.research.bell-labs.com [135.104.2.9]) by crufty.research.bell-labs.com (8.12.10/8.12.10) with ESMTP id h9KFeXnl041728; Mon, 20 Oct 2003 11:40:33 -0400 (EDT) Received: from mcs.research.bell-labs.com (mcs.research.bell-labs.com [135.104.32.15]) by grubby.research.bell-labs.com (8.12.9/8.12.9) with ESMTP id h9KFeQJl011921; Mon, 20 Oct 2003 11:40:26 -0400 (EDT) Received: from lucent.com (LUCENT-45825822.bl.bell-labs.com [135.104.37.232]) by mcs.research.bell-labs.com (8.12.9/8.12.9) with ESMTP id h9KFePDK488556; Mon, 20 Oct 2003 11:40:26 -0400 (EDT) Message-ID: <3F9401E9.5090103@lucent.com> Date: Mon, 20 Oct 2003 15:40:00 -0000 From: Benoit Raque Reply-To: raque@research.bell-labs.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20030925 X-Accept-Language: en-us, en MIME-Version: 1.0 To: James Ewing CC: pthreads-win32@sources.redhat.com Subject: Re: use pthread under winCE References: <3F8F10F2.8070509@lucent.com> <3F8FAAB4.9090201@sveasoft.com> <3F903F95.80205@lucent.com> <3F913A57.8000102@sveasoft.com> In-Reply-To: <3F913A57.8000102@sveasoft.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003/txt/msg00114.txt.bz2 Hi James, Thanks a lot for your help. I'm now able to compile the project for the emulator PocketPC2003 under eVC4. But when I try to compile for ARMv4, I get this error : "pthread_cancel.c(59) : fatal error C1189: #error : Module contains CPU-specific code; modify and recompile." Looking at the code just before, I want to add something like that : #if defined(_ARM_) #define PTW32_PROGCTR(Context) ((Context)."something here") #endif but Iar, Fir or Eip don't work. And I really don't know what I can put there. Thank you again. Benoit James Ewing wrote: > Hi Benoit, > > I've attached my modifications to the ptw32_getprocessors.c file that > fixes the GetProcessAffinityMask for WINCE. It just forces the > processor count to one. > > I looked in the pthread.h file and found that if you don't have _UWIN > defined, pthreads own internal _errno will be used. Make sure _UWIN is > *not* defined. See line 1143 in pthread.h. > > It was many moons ago that I tweaked pthreads for WIN32 for WINCE and > I've forgotten much of what needed to be done. If anyone wants a diff > of my build against the current CVS version just let me know and I'll > send it out. It might be a good idea to test it a bit and then merge > it into the main CVS tree. I use the same source for both WIN32 and > WINCE pthreads builds. > > Best, > > James > > > [ ptw32_getprocessors.c] > ---------------------------------------------------------------------- > /* > * ptw32_getprocessors() > * > * Get the number of CPUs available to the process. > * > * If the available number of CPUs is 1 then pthread_spin_lock() > * will block rather than spin if the lock is already owned. > * > * pthread_spin_init() calls this routine when initialising > * a spinlock. If the number of available processors changes > * (after a call to SetProcessAffinityMask()) then only > * newly initialised spinlocks will notice. > */ > int > ptw32_getprocessors(int * count) > { > int result = 0; > > #ifndef WINCE > DWORD vProcessCPUs; > DWORD vSystemCPUs; > > if (GetProcessAffinityMask(GetCurrentProcess(), > &vProcessCPUs, > &vSystemCPUs)) > { > DWORD bit; > int CPUs = 0; > > for (bit = 1; bit != 0; bit <<= 1) > { > if (vProcessCPUs & bit) > { > CPUs++; > } > } > *count = CPUs; > } > else > { > result = EAGAIN; > } > #else > *count = 1; > #endif > return(result); > // end of file > ----------------------------------------------------------- > > >