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
|
|
|
*
|
|
|
|
* Copyright (c) 2004, PostgreSQL Global Development Group
|
|
|
|
* IDENTIFICATION
|
2004-08-29 07:07:03 +02:00
|
|
|
* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.2 2004/08/29 05:07:00 momjian Exp $
|
2004-06-19 06:22:17 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "windows.h"
|
|
|
|
#include "pthread.h"
|
|
|
|
|
2004-08-29 07:07:03 +02:00
|
|
|
HANDLE
|
|
|
|
pthread_self()
|
2004-06-19 06:22:17 +02:00
|
|
|
{
|
2004-08-29 07:07:03 +02:00
|
|
|
return GetCurrentThread();
|
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
|
|
|
}
|