chromium/third_party/libvpx/source/libvpx/vpx_util/vpx_thread.h

// 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

#ifndef VPX_VPX_UTIL_VPX_THREAD_H_
#define VPX_VPX_UTIL_VPX_THREAD_H_

#ifdef __cplusplus
extern "C" {
#endif

// State of the worker thread object
VPxWorkerStatus;

// Function to be called by the worker thread. Takes two opaque pointers as
// arguments (data1 and data2). Should return true on success and return false
// in case of error.
VPxWorkerHook;

// Platform-dependent implementation details for the worker.
VPxWorkerImpl;

// Synchronization object used to launch job in the worker thread
VPxWorker;

// The interface for all thread-worker related functions. All these functions
// must be implemented.
VPxWorkerInterface;

// Install a new set of threading functions, overriding the defaults. This
// should be done before any workers are started, i.e., before any encoding or
// decoding takes place. The contents of the interface struct are copied, it
// is safe to free the corresponding memory after this call. This function is
// not thread-safe. Return false in case of invalid pointer or methods.
int vpx_set_worker_interface(const VPxWorkerInterface *const winterface);

// Retrieve the currently set thread worker interface.
const VPxWorkerInterface *vpx_get_worker_interface(void);

//------------------------------------------------------------------------------

#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // VPX_VPX_UTIL_VPX_THREAD_H_