xref: /relibc/pthreads-emb/tests/benchlib.c (revision 714af18cbe52336f4ff71fe91bfb035d5efaef7d)
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: jschmidlapp@users.sourceforge.net
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: rpj@callisto.canberra.edu.au
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 
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include "pthread.h"
44 #include "sched.h"
45 #include "semaphore.h"
46 #include "benchtest.h"
47 #include "implement.h"
48 
49 void
50 dummy_call(int * a)
51 {
52 }
53 
54 void
55 interlocked_inc_with_conditionals(int * a)
56 {
57   if (a != NULL)
58     if (PTE_ATOMIC_INCREMENT(a) == -1)
59       {
60         *a = 0;
61       }
62 }
63 
64 void
65 interlocked_dec_with_conditionals(int * a)
66 {
67   if (a != NULL)
68     if (PTE_ATOMIC_DECREMENT(a) == -1)
69       {
70         *a = 0;
71       }
72 }
73 
74 
75 /****************************************************************************************/
76