• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  *
4  * --------------------------------------------------------------------------
5  *
6  *      Pthreads-win32 - POSIX Threads Library for Win32
7  *      Copyright(C) 1998 John E. Bossom
8  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
9  *
10  *      Contact Email: rpj@callisto.canberra.edu.au
11  *
12  *      The current list of contributors is contained
13  *      in the file CONTRIBUTORS included with the source
14  *      code distribution. The list can also be seen at the
15  *      following World Wide Web location:
16  *      http://sources.redhat.com/pthreads-win32/contributors.html
17  *
18  *      This library is free software; you can redistribute it and/or
19  *      modify it under the terms of the GNU Lesser General Public
20  *      License as published by the Free Software Foundation; either
21  *      version 2 of the License, or (at your option) any later version.
22  *
23  *      This library is distributed in the hope that it will be useful,
24  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
25  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  *      Lesser General Public License for more details.
27  *
28  *      You should have received a copy of the GNU Lesser General Public
29  *      License along with this library in the file COPYING.LIB;
30  *      if not, write to the Free Software Foundation, Inc.,
31  *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
32  *
33  */
34 
35 enum {
36   OLD_WIN32CS,
37   OLD_WIN32MUTEX
38 };
39 
40 extern int old_mutex_use;
41 
42 struct old_mutex_t_ {
43   HANDLE mutex;
44   CRITICAL_SECTION cs;
45 };
46 
47 typedef struct old_mutex_t_ * old_mutex_t;
48 
49 struct old_mutexattr_t_ {
50   int pshared;
51 };
52 
53 typedef struct old_mutexattr_t_ * old_mutexattr_t;
54 
55 extern BOOL (WINAPI *ptw32_try_enter_critical_section)(LPCRITICAL_SECTION);
56 extern HINSTANCE ptw32_h_kernel32;
57 
58 #define PTW32_OBJECT_AUTO_INIT ((void *) -1)
59 
60 void dummy_call(int * a);
61 void interlocked_inc_with_conditionals(int *a);
62 void interlocked_dec_with_conditionals(int *a);
63 int old_mutex_init(old_mutex_t *mutex, const old_mutexattr_t *attr);
64 int old_mutex_lock(old_mutex_t *mutex);
65 int old_mutex_unlock(old_mutex_t *mutex);
66 int old_mutex_trylock(old_mutex_t *mutex);
67 int old_mutex_destroy(old_mutex_t *mutex);
68 /****************************************************************************************/
69