1
0

pthread-fixes.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (c) 2013, Sony Mobile Communications AB
  2. * Copyright (c) 2012, Google Inc.
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. * Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above
  10. copyright notice, this list of conditions and the following disclaimer
  11. in the documentation and/or other materials provided with the
  12. distribution.
  13. * Neither the name of Google Inc. nor the names of its
  14. contributors may be used to endorse or promote products derived from
  15. this software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  20. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  21. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  22. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H
  29. #define GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H
  30. #include <pthread.h>
  31. /*Android doesn't provide pthread_barrier_t for now.*/
  32. #ifndef PTHREAD_BARRIER_SERIAL_THREAD
  33. /* Anything except 0 will do here.*/
  34. #define PTHREAD_BARRIER_SERIAL_THREAD 0x12345
  35. typedef struct {
  36. pthread_mutex_t mutex;
  37. pthread_cond_t cond;
  38. unsigned count;
  39. } pthread_barrier_t;
  40. int pthread_barrier_init(pthread_barrier_t* barrier,
  41. const void* barrier_attr,
  42. unsigned count);
  43. int pthread_barrier_wait(pthread_barrier_t* barrier);
  44. int pthread_barrier_destroy(pthread_barrier_t *barrier);
  45. #endif /* defined(PTHREAD_BARRIER_SERIAL_THREAD) */
  46. int pthread_yield(void);
  47. #endif /* GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H */