// Copyright 2013 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // Multi-threaded worker // // Original source: // https://chromium.googlesource.com/webm/libwebp // Enable GNU extensions in glibc so that we can call pthread_setname_np(). // This must be before any #include statements. #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <assert.h> #include <string.h> // for memset() #include "./vpx_config.h" #include "./vpx_thread.h" #include "vpx_mem/vpx_mem.h" #include "vpx_util/vpx_pthread.h" #if CONFIG_MULTITHREAD struct VPxWorkerImpl { … }; //------------------------------------------------------------------------------ static void execute(VPxWorker *const worker); // Forward declaration. static THREADFN thread_loop(void *ptr) { … } // main thread state control static void change_state(VPxWorker *const worker, VPxWorkerStatus new_status) { … } #endif // CONFIG_MULTITHREAD //------------------------------------------------------------------------------ static void init(VPxWorker *const worker) { … } static int sync(VPxWorker *const worker) { … } static int reset(VPxWorker *const worker) { … } static void execute(VPxWorker *const worker) { … } static void launch(VPxWorker *const worker) { … } static void end(VPxWorker *const worker) { … } //------------------------------------------------------------------------------ static VPxWorkerInterface g_worker_interface = …; int vpx_set_worker_interface(const VPxWorkerInterface *const winterface) { … } const VPxWorkerInterface *vpx_get_worker_interface(void) { … } //------------------------------------------------------------------------------