benchlib.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. *
  3. *
  4. * --------------------------------------------------------------------------
  5. *
  6. * Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
  7. * Copyright(C) 2008 Jason Schmidlapp
  8. *
  9. * Contact Email: [email protected]
  10. *
  11. *
  12. * Based upon Pthreads-win32 - POSIX Threads Library for Win32
  13. * Copyright(C) 1998 John E. Bossom
  14. * Copyright(C) 1999,2005 Pthreads-win32 contributors
  15. *
  16. * Contact Email: [email protected]
  17. *
  18. * The original list of contributors to the Pthreads-win32 project
  19. * is contained in the file CONTRIBUTORS.ptw32 included with the
  20. * source code distribution. The list can also be seen at the
  21. * following World Wide Web location:
  22. * http://sources.redhat.com/pthreads-win32/contributors.html
  23. *
  24. * This library is free software; you can redistribute it and/or
  25. * modify it under the terms of the GNU Lesser General Public
  26. * License as published by the Free Software Foundation; either
  27. * version 2 of the License, or (at your option) any later version.
  28. *
  29. * This library is distributed in the hope that it will be useful,
  30. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  32. * Lesser General Public License for more details.
  33. *
  34. * You should have received a copy of the GNU Lesser General Public
  35. * License along with this library in the file COPYING.LIB;
  36. * if not, write to the Free Software Foundation, Inc.,
  37. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  38. *
  39. */
  40. #include <stdio.h>
  41. #include <stdlib.h>
  42. #include "pthread.h"
  43. #include "sched.h"
  44. #include "semaphore.h"
  45. #include "benchtest.h"
  46. #include "implement.h"
  47. void
  48. dummy_call(int * a)
  49. {
  50. }
  51. void
  52. interlocked_inc_with_conditionals(int * a)
  53. {
  54. if (a != NULL)
  55. if (PTE_ATOMIC_INCREMENT(a) == -1)
  56. {
  57. *a = 0;
  58. }
  59. }
  60. void
  61. interlocked_dec_with_conditionals(int * a)
  62. {
  63. if (a != NULL)
  64. if (PTE_ATOMIC_DECREMENT(a) == -1)
  65. {
  66. *a = 0;
  67. }
  68. }
  69. /****************************************************************************************/