PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pthread-win32.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2 *
3 * pthread-win32.c
4 * partial pthread implementation for win32
5 *
6 * Copyright (c) 2004-2017, PostgreSQL Global Development Group
7 * IDENTIFICATION
8 * src/interfaces/libpq/pthread-win32.c
9 *
10 *-------------------------------------------------------------------------
11 */
12 
13 #include "postgres_fe.h"
14 
15 #include "pthread-win32.h"
16 
17 DWORD
19 {
20  return GetCurrentThreadId();
21 }
22 
23 void
25 {
26 }
27 
28 void *
30 {
31  return NULL;
32 }
33 
34 int
36 {
37  *mp = (CRITICAL_SECTION *) malloc(sizeof(CRITICAL_SECTION));
38  if (!*mp)
39  return 1;
40  InitializeCriticalSection(*mp);
41  return 0;
42 }
43 
44 int
46 {
47  if (!*mp)
48  return 1;
49  EnterCriticalSection(*mp);
50  return 0;
51 }
52 
53 int
55 {
56  if (!*mp)
57  return 1;
58  LeaveCriticalSection(*mp);
59  return 0;
60 }
CRITICAL_SECTION * pthread_mutex_t
Definition: pthread-win32.h:8
ULONG pthread_key_t
Definition: pthread-win32.h:7
int pthread_mutex_init(pthread_mutex_t *mp, void *attr)
Definition: pthread-win32.c:35
#define malloc(a)
Definition: header.h:50
DWORD pthread_self(void)
Definition: pthread-win32.c:18
int pthread_mutex_lock(pthread_mutex_t *mp)
Definition: pthread-win32.c:45
int pthread_mutex_unlock(pthread_mutex_t *mp)
Definition: pthread-win32.c:54
#define NULL
Definition: c.h:229
void * pthread_getspecific(pthread_key_t key)
Definition: pthread-win32.c:29
void pthread_setspecific(pthread_key_t key, void *val)
Definition: pthread-win32.c:24
long val
Definition: informix.c:689