threadpool.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*****************************************************************************
  2. * threadpool.h: thread pooling
  3. *****************************************************************************
  4. * Copyright (C) 2010-2018 x264 project
  5. *
  6. * Authors: Steven Walters <kemuri9@gmail.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
  21. *
  22. * This program is also available under a commercial proprietary license.
  23. * For more information, contact us at licensing@x264.com.
  24. *****************************************************************************/
  25. #ifndef X264_THREADPOOL_H
  26. #define X264_THREADPOOL_H
  27. typedef struct x264_threadpool_t x264_threadpool_t;
  28. #if HAVE_THREAD
  29. #define x264_threadpool_init x264_template(threadpool_init)
  30. int x264_threadpool_init( x264_threadpool_t **p_pool, int threads,
  31. void (*init_func)(void *), void *init_arg );
  32. #define x264_threadpool_run x264_template(threadpool_run)
  33. void x264_threadpool_run( x264_threadpool_t *pool, void *(*func)(void *), void *arg );
  34. #define x264_threadpool_wait x264_template(threadpool_wait)
  35. void *x264_threadpool_wait( x264_threadpool_t *pool, void *arg );
  36. #define x264_threadpool_delete x264_template(threadpool_delete)
  37. void x264_threadpool_delete( x264_threadpool_t *pool );
  38. #else
  39. #define x264_threadpool_init(p,t,f,a) -1
  40. #define x264_threadpool_run(p,f,a)
  41. #define x264_threadpool_wait(p,a) NULL
  42. #define x264_threadpool_delete(p)
  43. #endif
  44. #endif