* use pthread under winCE
@ 2003-10-16 21:43 Benoit Raque
2003-10-17 8:40 ` James Ewing
0 siblings, 1 reply; 6+ messages in thread
From: Benoit Raque @ 2003-10-16 21:43 UTC (permalink / raw)
To: pthreads-win32
Hi,
I try to compile the pthreads-win32 library for winCE, but I can only
get a dll and a lib on the x86 format (using VC++6 to compile).
When I make a project in embedded Visual C (3 or 4), I get an error
"can't found process.h".
Is there a way to compile it in the ARM, MIPS or other format ?
Thank you for your help
Benoit Raque
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: use pthread under winCE
2003-10-16 21:43 use pthread under winCE Benoit Raque
@ 2003-10-17 8:40 ` James Ewing
2003-10-17 19:14 ` Benoit Raque
0 siblings, 1 reply; 6+ messages in thread
From: James Ewing @ 2003-10-17 8:40 UTC (permalink / raw)
To: raque; +Cc: pthreads-win32
Did you define WINCE in the project?
I compile pthreads for ARM using Micrsoft's Embedded Visual C++ 3.0
regularly and haven't had any problems. I have the following defines in
the config.h file:
#ifdef WINCE
#define NEED_DUPLICATEHANDLE
#define NEED_CREATETHREAD
#define NEED_ERRNO
#define NEED_CALLOC
#define NEED_FTIME
#define NEED_SEM
#define NEED_UNICODE_CONSTS
#endif
And the following in every file that includes <process.h>:
#if !defined(_UWIN) && !defined(WINCE)
#include <process.h>
#endif
Best Regards,
James Ewing
Benoit Raque wrote:
> Hi,
>
> I try to compile the pthreads-win32 library for winCE, but I can only
> get a dll and a lib on the x86 format (using VC++6 to compile).
> When I make a project in embedded Visual C (3 or 4), I get an error
> "can't found process.h".
>
> Is there a way to compile it in the ARM, MIPS or other format ?
>
>
> Thank you for your help
> Benoit Raque
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: use pthread under winCE
2003-10-17 8:40 ` James Ewing
@ 2003-10-17 19:14 ` Benoit Raque
2003-10-18 13:06 ` James Ewing
0 siblings, 1 reply; 6+ messages in thread
From: Benoit Raque @ 2003-10-17 19:14 UTC (permalink / raw)
To: James Ewing; +Cc: pthreads-win32
I have now declare WINCE, HAVE_CONFIG_H, and add some macros for
<process.h> and <sys/timeb.h> too.
The project now compile, with a warning :
ptw32_getprocessors.c(67) : warning C4013: 'GetProcessAffinityMask'
undefined; assuming extern returning int
But when it links I get these errors :
pthread.obj : error LNK2001: unresolved external symbol _errno
pthread.obj : error LNK2019: unresolved external symbol
_GetProcessAffinityMask referenced in function _ptw32_getprocessors
The _errno function is in the project and compile, I don't understand
why the linker don't find it.
The _GetProcessAffinityMask looks like a standard function for thread,
but I don't find it in the eVC include.
Benoit Raque
James Ewing wrote:
> Did you define WINCE in the project?
>
> I compile pthreads for ARM using Micrsoft's Embedded Visual C++ 3.0
> regularly and haven't had any problems. I have the following defines
> in the config.h file:
>
> #ifdef WINCE
> #define NEED_DUPLICATEHANDLE
> #define NEED_CREATETHREAD
> #define NEED_ERRNO
> #define NEED_CALLOC
> #define NEED_FTIME
> #define NEED_SEM
> #define NEED_UNICODE_CONSTS
> #endif
>
>
> And the following in every file that includes <process.h>:
>
> #if !defined(_UWIN) && !defined(WINCE)
> #include <process.h>
> #endif
>
> Best Regards,
>
> James Ewing
>
> Benoit Raque wrote:
>
>> Hi,
>>
>> I try to compile the pthreads-win32 library for winCE, but I can only
>> get a dll and a lib on the x86 format (using VC++6 to compile).
>> When I make a project in embedded Visual C (3 or 4), I get an error
>> "can't found process.h".
>>
>> Is there a way to compile it in the ARM, MIPS or other format ?
>>
>>
>> Thank you for your help
>> Benoit Raque
>>
>
>
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: use pthread under winCE
2003-10-17 19:14 ` Benoit Raque
@ 2003-10-18 13:06 ` James Ewing
2003-10-20 15:40 ` Benoit Raque
0 siblings, 1 reply; 6+ messages in thread
From: James Ewing @ 2003-10-18 13:06 UTC (permalink / raw)
To: raque; +Cc: pthreads-win32
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 -----------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: use pthread under winCE
2003-10-18 13:06 ` James Ewing
@ 2003-10-20 15:40 ` Benoit Raque
2003-10-20 17:19 ` James Ewing
0 siblings, 1 reply; 6+ messages in thread
From: Benoit Raque @ 2003-10-20 15:40 UTC (permalink / raw)
To: James Ewing; +Cc: pthreads-win32
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
> -----------------------------------------------------------
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: use pthread under winCE
2003-10-20 15:40 ` Benoit Raque
@ 2003-10-20 17:19 ` James Ewing
0 siblings, 0 replies; 6+ messages in thread
From: James Ewing @ 2003-10-20 17:19 UTC (permalink / raw)
To: raque; +Cc: pthreads-win32
Hi Benoit,
Try inserting the following:
#if defined(_ARM_)
#define PTW32_PROGCTR(Context) ((Context).Psr)
#endif
Best Regards,
James
Benoit Raque wrote:
> 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
>> -----------------------------------------------------------
>>
>>
>>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-10-20 17:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-16 21:43 use pthread under winCE Benoit Raque
2003-10-17 8:40 ` James Ewing
2003-10-17 19:14 ` Benoit Raque
2003-10-18 13:06 ` James Ewing
2003-10-20 15:40 ` Benoit Raque
2003-10-20 17:19 ` James Ewing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).