postgresql/src/interfaces/libpq/pthread-win32.c

52 lines
907 B
C
Raw Normal View History

/*-------------------------------------------------------------------------
*
* pthread-win32.c
2004-08-29 07:07:03 +02:00
* partial pthread implementation for win32
*
* Copyright (c) 2004-2007, PostgreSQL Global Development Group
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.13 2007/01/05 22:20:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include <windows.h>
#include "pthread-win32.h"
DWORD
2004-08-29 07:07:03 +02:00
pthread_self()
{
2005-08-28 20:49:01 +02:00
return GetCurrentThreadId();
}
2004-08-29 07:07:03 +02:00
void
pthread_setspecific(pthread_key_t key, void *val)
{
}
2004-08-29 07:07:03 +02:00
void *
pthread_getspecific(pthread_key_t key)
{
2004-08-29 07:07:03 +02:00
return NULL;
}
2004-08-29 07:07:03 +02:00
void
pthread_mutex_init(pthread_mutex_t *mp, void *attr)
{
2004-08-29 07:07:03 +02:00
*mp = CreateMutex(0, 0, 0);
}
2004-08-29 07:07:03 +02:00
void
pthread_mutex_lock(pthread_mutex_t *mp)
{
2004-08-29 07:07:03 +02:00
WaitForSingleObject(*mp, INFINITE);
}
2004-08-29 07:07:03 +02:00
void
pthread_mutex_unlock(pthread_mutex_t *mp)
{
2004-08-29 07:07:03 +02:00
ReleaseMutex(*mp);
}