2004-06-19 06:22:17 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* pthread-win32.c
|
2004-08-29 07:07:03 +02:00
|
|
|
* partial pthread implementation for win32
|
2004-06-19 06:22:17 +02:00
|
|
|
*
|
2008-01-01 20:46:01 +01:00
|
|
|
* Copyright (c) 2004-2008, PostgreSQL Global Development Group
|
2004-06-19 06:22:17 +02:00
|
|
|
* IDENTIFICATION
|
2008-01-01 20:46:01 +01:00
|
|
|
* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.15 2008/01/01 19:46:00 momjian Exp $
|
2004-06-19 06:22:17 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2006-07-29 17:22:27 +02:00
|
|
|
#include "postgres_fe.h"
|
2004-06-19 06:22:17 +02:00
|
|
|
|
2004-09-26 03:40:55 +02:00
|
|
|
#include <windows.h>
|
2005-08-23 23:02:05 +02:00
|
|
|
#include "pthread-win32.h"
|
2004-06-19 06:22:17 +02:00
|
|
|
|
2005-08-28 23:42:28 +02:00
|
|
|
DWORD
|
2007-04-18 10:32:40 +02:00
|
|
|
pthread_self(void)
|
2004-06-19 06:22:17 +02:00
|
|
|
{
|
2005-08-28 20:49:01 +02:00
|
|
|
return GetCurrentThreadId();
|
2004-06-19 06:22:17 +02:00
|
|
|
}
|
|
|
|
|
2004-08-29 07:07:03 +02:00
|
|
|
void
|
|
|
|
pthread_setspecific(pthread_key_t key, void *val)
|
2004-06-19 06:22:17 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-08-29 07:07:03 +02:00
|
|
|
void *
|
|
|
|
pthread_getspecific(pthread_key_t key)
|
2004-06-19 06:22:17 +02:00
|
|
|
{
|
2004-08-29 07:07:03 +02:00
|
|
|
return NULL;
|
2004-06-19 06:22:17 +02:00
|
|
|
}
|
|
|
|
|
2004-08-29 07:07:03 +02:00
|
|
|
void
|
|
|
|
pthread_mutex_init(pthread_mutex_t *mp, void *attr)
|
2004-06-19 06:22:17 +02:00
|
|
|
{
|
2004-08-29 07:07:03 +02:00
|
|
|
*mp = CreateMutex(0, 0, 0);
|
2004-06-19 06:22:17 +02:00
|
|
|
}
|
|
|
|
|
2004-08-29 07:07:03 +02:00
|
|
|
void
|
|
|
|
pthread_mutex_lock(pthread_mutex_t *mp)
|
2004-06-19 06:22:17 +02:00
|
|
|
{
|
2004-08-29 07:07:03 +02:00
|
|
|
WaitForSingleObject(*mp, INFINITE);
|
2004-06-19 06:22:17 +02:00
|
|
|
}
|
|
|
|
|
2004-08-29 07:07:03 +02:00
|
|
|
void
|
|
|
|
pthread_mutex_unlock(pthread_mutex_t *mp)
|
2004-06-19 06:22:17 +02:00
|
|
|
{
|
2004-08-29 07:07:03 +02:00
|
|
|
ReleaseMutex(*mp);
|
2004-06-19 06:22:17 +02:00
|
|
|
}
|