void initializeMainThreadPlatform() { if (threadingWindowHandle) return; HWND hWndParent = 0; #if OS(WINCE) WNDCLASS wcex; memset(&wcex, 0, sizeof(WNDCLASS)); #else WNDCLASSEX wcex; memset(&wcex, 0, sizeof(WNDCLASSEX)); wcex.cbSize = sizeof(WNDCLASSEX); #endif wcex.lpfnWndProc = ThreadingWindowWndProc; wcex.lpszClassName = kThreadingWindowClassName; #if OS(WINCE) RegisterClass(&wcex); #else RegisterClassEx(&wcex); hWndParent = HWND_MESSAGE; #endif threadingWindowHandle = CreateWindow(kThreadingWindowClassName, 0, 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWndParent, 0, 0, 0); threadingFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.MainThreadFired"); initializeCurrentThreadInternal("Main Thread"); }
static void* threadEntryPoint(void* contextData) { NewThreadContext* context = reinterpret_cast<NewThreadContext*>(contextData); // Block until our creating thread has completed any extra setup work, including // establishing ThreadIdentifier. { MutexLocker locker(context->creationMutex); } initializeCurrentThreadInternal(context->name); // Grab the info that we need out of the context, then deallocate it. ThreadFunction entryPoint = context->entryPoint; void* data = context->data; delete context; #if OS(BLACKBERRY) Olympia::Platform::addStackBase(&data); void* result = entryPoint(data); Olympia::Platform::removeStackBase(); return result; #else return entryPoint(data); #endif }
void initializeThreading() { if (!atomicallyInitializedStaticMutex) { atomicallyInitializedStaticMutex = new Mutex; threadMapMutex(); initializeRandomNumberGenerator(); initializeMainThread(); mainThreadIdentifier = currentThread(); initializeCurrentThreadInternal("Main Thread"); } }
static void threadEntryPoint(void* contextData) { NewThreadContext* context = reinterpret_cast<NewThreadContext*>(contextData); // Block until our creating thread has completed any extra setup work, including // establishing ThreadIdentifier. { MutexLocker locker(context->creationMutex); } initializeCurrentThreadInternal(context->name); // Grab the info that we need out of the context, then deallocate it. ThreadFunction entryPoint = context->entryPoint; void* data = context->data; delete context; entryPoint(data); }
static void threadEntryPoint(void* contextData) { NewThreadContext* context = static_cast<NewThreadContext*>(contextData); // Block until our creating thread has completed any extra setup work, including // establishing ThreadIdentifier. { MutexLocker locker(context->creationMutex); } initializeCurrentThreadInternal(context->name); auto entryPoint = WTFMove(context->entryPoint); // Delete the context before starting the thread. delete context; entryPoint(); }