apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Friedrich Dominicus <fr...@q-software-solutions.de>
Subject Re: portability
Date Wed, 24 Nov 2004 14:24:52 GMT
Garrett Rooney <rooneg@electricjellyfish.net> writes:

> Friedrich Dominicus wrote:
>> This may sound a bit ridicolous, however I wonder how serious you are
>> about the portability of the code used for libapr. Is it wanted that
>> compiler/llibrary internals of specific compilers are used? Or is that
>> considered a bug?
>
> It needs to be portable ;-)
>
> Seriously, if you have some way to make something a bazillion times
> faster by using a gcc extension then I suppose it might be considered,
> but you'd also have to provide a non-gcc version of the code for cases
> where that wasn't possible.  People compile APR with all sorts of
> compilters.
How about this code then?


/* #ifndef _WIN32_WCE
    if (((*new)->td = (HANDLE)_beginthreadex(NULL,
                        attr && attr->stacksize > 0 ? attr->stacksize : 0,
                        (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
                        (*new), 0, &temp)) == 0) {
        return APR_FROM_OS_ERROR(_doserrno);
    }
#else
*/
   if (((*new)->td = CreateThread(NULL,
                        attr && attr->stacksize > 0 ? attr->stacksize : 0,
                        (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
                        (*new), 0, &temp)) == 0) {
        return apr_get_os_error();
    }
// #endif

The latter works on Windows XP and probably others as well whereas the
first one uses a compiler specific internal symbol

Regards
Friedrich

Mime
View raw message