[sane-devel] Windows pthread issue

Chris Bagwell chris at cnpbagwell.com
Thu Mar 1 17:20:48 UTC 2012


On Wed, Feb 29, 2012 at 1:00 PM, Michael Cronenworth <mike at cchtml.com> wrote:
> Hi All/Chris,
>
> Fedora (17) is moving away from mingw.org to the w64 MinGW environment.
>
> The w64 folks have a new pthreads implementation called "winpthreads" and I
> have encountered an issue with it when compiling sane-backends.
>
> For the Windows build you try to expand the pthread_t pointer. Under
> "winpthreads" a pthread_t is not defined as a struct. Could you read the
> following support thread on the w64 sourceforge page and make any comments
> or corrections?
>
> https://sourceforge.net/tracker/index.php?func=detail&aid=3495128&group_id=202880&atid=983355

Can you test a possible fix since you have access?  They appear to be
using an unsigned pointer so traditional "-1" can't be used.  In
sanei_thread.c, modify these three blocks:

#ifdef WIN32
        pid->p = 0;

[...]

#ifdef WIN32
        if (pid.p == 0)
            rc = SANE_TRUE;

[...]

#ifdef WIN32
        rc = pid.p;

to become:

#ifdef WIN32
#ifdef WINTHREADS_API
        pid->p = 0;
#else
        pid->p = NULL;
#endif

[...]

#ifdef WIN32
#ifdef WINTHREADS_API
        if (pid == NULL)
#else
        if (pid.p == 0)
#endif
            rc = SANE_TRUE;

[...]

#ifdef WIN32
#ifdef WINTHREADS_API
        rc = (long)pid;
#else
        rc = pid.p;
#endif

Chris

>
> Thanks,
> Michael



More information about the sane-devel mailing list