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 <windows.h>
16 #include "pthread-win32.h"
17 
18 DWORD
20 {
21  return GetCurrentThreadId();
22 }
23 
24 void
26 {
27 }
28 
29 void *
31 {
32  return NULL;
33 }
34 
35 int
37 {
38  *mp = (CRITICAL_SECTION *) malloc(sizeof(CRITICAL_SECTION));
39  if (!*mp)
40  return 1;
41  InitializeCriticalSection(*mp);
42  return 0;
43 }
44 
45 int
47 {
48  if (!*mp)
49  return 1;
50  EnterCriticalSection(*mp);
51  return 0;
52 }
53 
54 int
56 {
57  if (!*mp)
58  return 1;
59  LeaveCriticalSection(*mp);
60  return 0;
61 }
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:36
#define malloc(a)
Definition: header.h:45
DWORD pthread_self(void)
Definition: pthread-win32.c:19
int pthread_mutex_lock(pthread_mutex_t *mp)
Definition: pthread-win32.c:46
int pthread_mutex_unlock(pthread_mutex_t *mp)
Definition: pthread-win32.c:55
#define NULL
Definition: c.h:226
void * pthread_getspecific(pthread_key_t key)
Definition: pthread-win32.c:30
void pthread_setspecific(pthread_key_t key, void *val)
Definition: pthread-win32.c:25
long val
Definition: informix.c:689