[webkit-dev] [webkit-changes] [35474] trunk/JavaScriptCore

Eric Seidel eric at webkit.org
Thu Jul 31 01:58:02 PDT 2008


I think it's wrong for JSC to assume pthreads.  Gtk seems to have its
own threading system.  Windows does too.  It's unclear to me (aside
from the comment below) why it needs them long term.

>From wtf/ThreadingWin.cpp (why is this not in wtf/win/?)

#if PLATFORM(WIN)
// Currently, Apple's Windows port uses a mixture of native and
pthreads functions in FastMalloc.
// To ensure that thread-specific data is properly destroyed, we need
to end each thread with pthread_exit().
#include <pthread.h>
#endif

-eric

On Thu, Jul 31, 2008 at 1:08 AM, Alexey Proskuryakov <ap at webkit.org> wrote:
>
> On Jul 31, 2008, at 10:38 AM, eric at webkit.org wrote:
>
>         Try to clean up our usage of USE(MULTIPLE_THREADS) vs. USE(PTHREADS)
> a little.
>
> There is indeed some confusion between MULTIPLE_THREADS and PTHREADS in JSC
> now. One of the reasons is that some of the threading code can be used in
> WebCore even if JSC is not threaded, and vice versa. The former macro
> enables JSC multithreading, while the latter in not as clear cut.
>
>         It looks like JSC assumes that if MULTIPLE_THREADS is defined, then
> pthreads will always be available
>         I'm not sure that's always the case for gtk, certainly not for
> Windows.  We should eventually go back
>         and fix wtf/Threading.h to cover all these cases some day.
>
> Yes, JSC currently assumes that pthreads is available for MULTIPLE_THREADS.
> It is not at all obvious to me that this is a wrong assumption - we'd need a
> compatibility layer for platforms that don't have native pthreads anyway, so
> why not use existing pthreads implementations for these platforms? We do
> that on Windows, for example.
> Let's discuss this before declaring it wrong at least.
>
> Modified: trunk/JavaScriptCore/kjs/collector.h (35473 => 35474)
>
> --- trunk/JavaScriptCore/kjs/collector.h	2008-07-31 06:14:13 UTC (rev 35473)
> +++ trunk/JavaScriptCore/kjs/collector.h	2008-07-31 06:38:54 UTC (rev 35474)
> @@ -28,9 +28,6 @@
>  #include <wtf/Noncopyable.h>
>  #include <wtf/OwnPtr.h>
>  #include <wtf/Threading.h>
> -#if USE(MULTIPLE_THREADS)
> -#include <pthread.h>
> -#endif
>
> This change in particular seems wrong to me - the file
> uses pthread_key_t under #if USE(MULTIPLE_THREADS), but pthread.h is only
> included in Threading.h under #if USE(PTHREADS).
> - WBR, Alexey Proskuryakov
>


More information about the webkit-dev mailing list