Blame gl/tests/windows-recmutex.h

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