windows-once.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Once-only control (native Windows implementation).
  2. Copyright (C) 2005-2021 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <https://www.gnu.org/licenses/>. */
  13. /* Written by Bruno Haible <bruno@clisp.org>, 2005.
  14. Based on GCC's gthr-win32.h. */
  15. #ifndef _WINDOWS_ONCE_H
  16. #define _WINDOWS_ONCE_H
  17. #define WIN32_LEAN_AND_MEAN /* avoid including junk */
  18. #include <windows.h>
  19. typedef struct
  20. {
  21. volatile int inited;
  22. volatile LONG started;
  23. CRITICAL_SECTION lock;
  24. }
  25. glwthread_once_t;
  26. #define GLWTHREAD_ONCE_INIT { -1, -1 }
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. extern void glwthread_once (glwthread_once_t *once_control,
  31. void (*initfunction) (void));
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif /* _WINDOWS_ONCE_H */