use_starpu_pthread_macros_test.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // StarPU --- Runtime system for heterogeneous multicore architectures.
  2. //
  3. // Copyright (C) 2011-2012 Inria
  4. // Copyright (C) 2011 CNRS
  5. //
  6. // StarPU is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Lesser General Public License as published by
  8. // the Free Software Foundation; either version 2.1 of the License, or (at
  9. // your option) any later version.
  10. //
  11. // StarPU is distributed in the hope that it will be useful, but
  12. // WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. //
  15. // See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. static void
  17. foo(void)
  18. {
  19. pthread_create(&th, NULL, f, &arg);
  20. pthread_mutex_init(&mutex, NULL);
  21. pthread_mutex_lock(&mutex);
  22. pthread_mutex_unlock(&mutex);
  23. pthread_mutex_destroy(&mutex);
  24. pthread_rwlock_init(&rwlock);
  25. pthread_rwlock_rdlock(&rwlock);
  26. pthread_rwlock_wrlock(&rwlock);
  27. pthread_rwlock_unlock(&rwlock);
  28. pthread_rwlock_destroy(&rwlock);
  29. pthread_cond_init(&cond, NULL);
  30. pthread_cond_signal(&cond);
  31. pthread_cond_broadcast(&cond);
  32. pthread_cond_wait(&cond, &mutex);
  33. pthread_cond_destroy(&cond);
  34. pthread_barrier_init(&barrier, NULL, 42);
  35. pthread_barrier_wait(&barrier);
  36. pthread_barrier_destroy(&barrier);
  37. }