From: Marcel Ruff <mr@marcelruff.info>
To: pthreads-win32@sources.redhat.com
Subject: Re: Patch of current cvs for WinCE
Date: Tue, 28 Nov 2006 16:27:00 -0000 [thread overview]
Message-ID: <456C63DC.4010008@marcelruff.info> (raw)
In-Reply-To: <456C62A1.9090202@marcelruff.info>
Marcel Ruff wrote:
> Hi,
>
> with some minor changes the pthreads CVS snapshot from
> today (2006-11-28 PTW32_VERSION 2,8,0,0) compiles with
>
> Visual C++ 8.0.5 2005 (on a XP)
>
> for the target
>
> Windows CE 4.2, Smartphone 2003 with ARM4 processor.
>
> My multi threaded application seem to run fine, but
> it keeps getting strange return codes for
>
> pthread_cond_destroy()
> pthread_mutex_destroy()
>
> those calls return 16 (which is EBUSY) in need_errno.h.
> I ignore it and my applications continues as expected.
>
> Most probably this (my) hack is the reason:
>
> What do i have to return in pthread_cancel.c instead of FpExc??
> 43a44,47
> > #if defined(WINCE)
> > #define PTW32_PROGCTR(Context) ((Context).FpExc)
> > #endif
> (Context is defined in my winnt.h)
Here it is: C:\Program Files\Microsoft Visual Studio
8\SmartDevices\SDK\Smartphone2003\Include\winnt.h
...
typedef struct _CONTEXT {
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
ULONG ContextFlags;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_INTEGER.
//
ULONG R0;
ULONG R1;
ULONG R2;
ULONG R3;
ULONG R4;
ULONG R5;
ULONG R6;
ULONG R7;
ULONG R8;
ULONG R9;
ULONG R10;
ULONG R11;
ULONG R12;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_CONTROL.
//
ULONG Sp;
ULONG Lr;
ULONG Pc;
ULONG Psr;
#define NUM_VFP_REGS 32
#define NUM_EXTRA_CONTROL_REGS 8
// Floating point registers
ULONG Fpscr;
ULONG FpExc;
ULONG S[NUM_VFP_REGS+1];
ULONG FpExtra[NUM_EXTRA_CONTROL_REGS];
} CONTEXT;
....
>
>
> What is the role of process.h (as i have disabled it, see patch below)?
>
> In errno.c there are pthread_self () returns pthread_t
> which is sometimes a pointer on a big struct, whereas in
> my case it ended up to
> typedef struct {
> void * p; /* Pointer to actual object */
> unsigned int x; /* Extra information - reuse count etc */
> } ptw32_handle_t;
>
>
>
> How can i track this down?
>
> thank you
> Marcel
>
>
>
>
> ====== the patch =======
> Index: create.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/create.c,v
> retrieving revision 1.63
> diff -r1.63 create.c
> 41c41,43
> < #include <process.h>
> ---
> > # ifndef WINCE
> > # include <process.h>
> > # endif
> Index: errno.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/errno.c,v
> retrieving revision 1.13
> diff -r1.13 errno.c
> 76a77,90
> > # ifdef WINCE
> > if ((self = pthread_self ()).p == NULL)
> > {
> > /*
> > * Yikes! unable to allocate a thread!
> > * Throw an exception? return an error?
> > */
> > result = &reallyBad;
> > }
> > else
> > {
> > result = 0; /* &(self.x) Which errno is appropriate? */
> > }
> > # else
> 88a103
> > # endif
> Index: exit.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/exit.c,v
> retrieving revision 1.40
> diff -r1.40 exit.c
> 41c41,43
> < # include <process.h>
> ---
> > # ifndef WINCE
> > # include <process.h>
> > # endif
> Index: implement.h
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/implement.h,v
> retrieving revision 1.117
> diff -r1.117 implement.h
> 661c661,663
> < # include <process.h>
> ---
> > # ifndef WINCE
> > # include <process.h>
> > # endif
> Index: mutex.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/mutex.c,v
> retrieving revision 1.63
> diff -r1.63 mutex.c
> 38c38,40
> < # include <process.h>
> ---
> > # ifndef WINCE
> > # include <process.h>
> > # endif
> Index: pthread.h
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread.h,v
> retrieving revision 1.135
> diff -r1.135 pthread.h
> 1215c1215,1217
> < PTW32_DLLPORT int * PTW32_CDECL _errno( void );
> ---
> > # ifndef WINCE
> > PTW32_DLLPORT int * PTW32_CDECL _errno( void );
> > # endif
> Index: pthread_cancel.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_cancel.c,v
> retrieving revision 1.10
> diff -r1.10 pthread_cancel.c
> 43a44,47
> > #if defined(WINCE)
> > #define PTW32_PROGCTR(Context) ((Context).FpExc)
> > #endif
> >
> Index: pthread_detach.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_detach.c,v
> retrieving revision 1.10
> diff -r1.10 pthread_detach.c
> 45c45,47
> < #include <signal.h>
> ---
> > #ifndef WINCE
> > # include <signal.h>
> > #endif
> Index: pthread_join.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_join.c,v
> retrieving revision 1.11
> diff -r1.11 pthread_join.c
> 45c45,47
> < #include <signal.h>
> ---
> > #ifndef WINCE
> > # include <signal.h>
> > #endif
> Index: pthread_kill.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_kill.c,v
> retrieving revision 1.7
> diff -r1.7 pthread_kill.c
> 44c44,46
> < #include <signal.h>
> ---
> > #ifndef WINCE
> > # include <signal.h>
> > #endif
> Index: pthread_rwlock_destroy.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_destroy.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_destroy.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_init.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_init.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_init.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_rdlock.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_rdlock.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_rdlock.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_timedrdlock.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_timedrdlock.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_timedrdlock.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_timedwrlock.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_timedwrlock.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_timedwrlock.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_tryrdlock.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_tryrdlock.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_tryrdlock.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_trywrlock.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_trywrlock.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_trywrlock.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_unlock.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_unlock.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlock_unlock.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlock_wrlock.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlock_wrlock.c,v
> retrieving revision 1.6
> diff -r1.6 pthread_rwlock_wrlock.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlockattr_destroy.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlockattr_destroy.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlockattr_destroy.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlockattr_getpshared.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlockattr_getpshared.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlockattr_getpshared.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlockattr_init.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlockattr_init.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlockattr_init.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
> Index: pthread_rwlockattr_setpshared.c
> ===================================================================
> RCS file: /cvs/pthreads-win32/pthreads/pthread_rwlockattr_setpshared.c,v
> retrieving revision 1.5
> diff -r1.5 pthread_rwlockattr_setpshared.c
> 37c37
> < #include <errno.h>
> ---
> > /*#include <errno.h> is included by pthread.h (Marcel Ruff
> 2006-11-28) */
>
>
>
>
next prev parent reply other threads:[~2006-11-28 16:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-28 16:22 Marcel Ruff
2006-11-28 16:27 ` Marcel Ruff [this message]
2006-11-29 11:09 ` Marcel Ruff
2006-12-05 21:14 ` semaphores and handle leaks Morgan McLeod
2006-12-05 23:12 ` Morgan McLeod
2007-01-07 2:30 ` Ross Johnson
2007-01-08 14:31 ` Morgan McLeod
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=456C63DC.4010008@marcelruff.info \
--to=mr@marcelruff.info \
--cc=pthreads-win32@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).