use_starpu_pthread_macros_test.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2011-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  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. }