1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-10-13 18:03:39 -04:00
trader/lib/windows-recmutex.h
John Zaitseff 91538aac7f Update all auto-generated files
These files have been created by running ./build-aux/bootstrap with
Gnulib as at commit b3b1e95ca1de55cef8fa04b165c48b2178bb545d (with a date
stamp of Mon Nov 11 13:04:02 2019 -0800), Autoconf 2.69, Automake 1.16.1,
Gettext 0.19.8.1 and pkg-config 0.29.
2019-11-13 08:58:46 +11:00

58 lines
1.9 KiB
C

/* Plain recursive mutexes (native Windows implementation).
Copyright (C) 2005-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2005.
Based on GCC's gthr-win32.h. */
#ifndef _WINDOWS_RECMUTEX_H
#define _WINDOWS_RECMUTEX_H
#define WIN32_LEAN_AND_MEAN /* avoid including junk */
#include <windows.h>
#include "windows-initguard.h"
/* The native Windows documentation says that CRITICAL_SECTION already
implements a recursive lock. But we need not rely on it: It's easy to
implement a recursive lock without this assumption. */
typedef struct
{
glwthread_initguard_t guard; /* protects the initialization */
DWORD owner;
unsigned long depth;
CRITICAL_SECTION lock;
}
glwthread_recmutex_t;
#define GLWTHREAD_RECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 }
#ifdef __cplusplus
extern "C" {
#endif
extern void glwthread_recmutex_init (glwthread_recmutex_t *mutex);
extern int glwthread_recmutex_lock (glwthread_recmutex_t *mutex);
extern int glwthread_recmutex_trylock (glwthread_recmutex_t *mutex);
extern int glwthread_recmutex_unlock (glwthread_recmutex_t *mutex);
extern int glwthread_recmutex_destroy (glwthread_recmutex_t *mutex);
#ifdef __cplusplus
}
#endif
#endif /* _WINDOWS_RECMUTEX_H */