You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Yann Ylavic <yl...@gmail.com> on 2022/01/19 17:29:51 UTC

Re: svn commit: r1895508 - in /apr/apr/trunk: dso/win32/ file_io/win32/ locks/win32/ misc/unix/ misc/win32/ network_io/unix/ network_io/win32/ passwd/ shmem/win32/ threadproc/win32/ time/win32/ user/win32/

On Thu, Dec 2, 2021 at 10:21 PM <mt...@apache.org> wrote:
>
> Author: mturk
> Date: Thu Dec  2 21:21:18 2021
> New Revision: 1895508
>
> URL: http://svn.apache.org/viewvc?rev=1895508&view=rev
> Log:
> Stage 3 in dismantling _WIN32_WCE ... cleanup code
>
[]
> Modified: apr/apr/trunk/threadproc/win32/thread.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/threadproc/win32/thread.c?rev=1895508&r1=1895507&r2=1895508&view=diff
> ==============================================================================
> --- apr/apr/trunk/threadproc/win32/thread.c (original)
> +++ apr/apr/trunk/threadproc/win32/thread.c Thu Dec  2 21:21:18 2021
> @@ -138,21 +138,12 @@ APR_DECLARE(apr_status_t) apr_thread_cre
>      /* Use 0 for default Thread Stack Size, because that will
>       * default the stack to the same size as the calling thread.
>       */
> -#ifndef _WIN32_WCE
>      if ((handle = (HANDLE)_beginthreadex(NULL,
>                          (DWORD) (attr ? attr->stacksize : 0),
>                          (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
>                          (*new), 0, &temp)) == 0) {
>          return APR_FROM_OS_ERROR(_doserrno);
>      }
> -#else
> -   if ((handle = 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

I'm a bit surprised that _WIN32_WCE used CreateThread() while more
recent ones use _beginthreadex(), shouldn't it be the opposite?
CreateThread() aligns more with the usual/modern naming convention on Windows..

Regards;
Yann.

Re: svn commit: r1895508 - in /apr/apr/trunk: dso/win32/ file_io/win32/ locks/win32/ misc/unix/ misc/win32/ network_io/unix/ network_io/win32/ passwd/ shmem/win32/ threadproc/win32/ time/win32/ user/win32/

Posted by William A Rowe Jr <wr...@rowe-clan.net>.
On Thu, Jan 20, 2022 at 12:49 PM Ivan Zhakov <iv...@visualsvn.com> wrote:
>
> On Thu, 20 Jan 2022 at 00:43, William A Rowe Jr <wr...@rowe-clan.net> wrote:
>>
>> On Wed, Jan 19, 2022 at 11:31 AM Yann Ylavic <yl...@gmail.com> wrote:
>> >
>> > I'm a bit surprised that _WIN32_WCE used CreateThread() while more
>> > recent ones use _beginthreadex(), shouldn't it be the opposite?
>> > CreateThread() aligns more with the usual/modern naming convention on Windows..
>>
>> Ignore naming conventions. We are a library that sits on top of
>> MSVCRT/LIBCMT, and
>> so the stdc lib we use needs to know a thread has started.
>> CreateThread doesn't let
>> the clib particpate and this causes specific problems for .dll loaded
>> modules like our lib.
>
> That's true.
>
> But Microsoft finally fixed this in Universal CRT ( Visual Studio 2015). In UCRT beginthreadex() is almost a wrapper around CreateThread(). So maybe it makes sense to require VS 2015 for APR trunk and just use CreateThread?

This is my docker build env... you won't find any argument from me;
https://github.com/envoyproxy/envoy-build-tools/blob/main/build_container/build_container_windows.ps1

Re: svn commit: r1895508 - in /apr/apr/trunk: dso/win32/ file_io/win32/ locks/win32/ misc/unix/ misc/win32/ network_io/unix/ network_io/win32/ passwd/ shmem/win32/ threadproc/win32/ time/win32/ user/win32/

Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Thu, 20 Jan 2022 at 00:43, William A Rowe Jr <wr...@rowe-clan.net> wrote:

> On Wed, Jan 19, 2022 at 11:31 AM Yann Ylavic <yl...@gmail.com> wrote:
> >
> > I'm a bit surprised that _WIN32_WCE used CreateThread() while more
> > recent ones use _beginthreadex(), shouldn't it be the opposite?
> > CreateThread() aligns more with the usual/modern naming convention on
> Windows..
>
> Ignore naming conventions. We are a library that sits on top of
> MSVCRT/LIBCMT, and
> so the stdc lib we use needs to know a thread has started.
> CreateThread doesn't let
> the clib particpate and this causes specific problems for .dll loaded
> modules like our lib.
>
That's true.

But Microsoft finally fixed this in Universal CRT ( Visual Studio 2015). In
UCRT beginthreadex() is almost a wrapper around CreateThread(). So maybe it
makes sense to require VS 2015 for APR trunk and just use CreateThread?

-- 
Ivan Zhakov

Re: svn commit: r1895508 - in /apr/apr/trunk: dso/win32/ file_io/win32/ locks/win32/ misc/unix/ misc/win32/ network_io/unix/ network_io/win32/ passwd/ shmem/win32/ threadproc/win32/ time/win32/ user/win32/

Posted by William A Rowe Jr <wr...@rowe-clan.net>.
On Wed, Jan 19, 2022 at 11:31 AM Yann Ylavic <yl...@gmail.com> wrote:
>
> I'm a bit surprised that _WIN32_WCE used CreateThread() while more
> recent ones use _beginthreadex(), shouldn't it be the opposite?
> CreateThread() aligns more with the usual/modern naming convention on Windows..

Ignore naming conventions. We are a library that sits on top of
MSVCRT/LIBCMT, and
so the stdc lib we use needs to know a thread has started.
CreateThread doesn't let
the clib particpate and this causes specific problems for .dll loaded
modules like our lib.