summaryrefslogtreecommitdiffstats
path: root/include/libusb-1.0/os/threads_windows.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libusb-1.0/os/threads_windows.h')
-rw-r--r--include/libusb-1.0/os/threads_windows.h84
1 files changed, 0 insertions, 84 deletions
diff --git a/include/libusb-1.0/os/threads_windows.h b/include/libusb-1.0/os/threads_windows.h
deleted file mode 100644
index 2cd1867..0000000
--- a/include/libusb-1.0/os/threads_windows.h
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * libusb synchronization on Microsoft Windows
3 *
4 * Copyright (C) 2010 Michael Plante <michael.plante@gmail.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef __LIBUSB_THREADS_WINDOWS_H__
22#define __LIBUSB_THREADS_WINDOWS_H__
23
24#define usbi_mutex_static_t volatile LONG
25#define USBI_MUTEX_INITIALIZER 0
26
27#define usbi_mutex_t HANDLE
28
29struct usbi_cond_perthread {
30 struct list_head list;
31 DWORD tid;
32 HANDLE event;
33};
34struct usbi_cond_t_ {
35 // Every time a thread touches the CV, it winds up in one of these lists.
36 // It stays there until the CV is destroyed, even if the thread
37 // terminates.
38 struct list_head waiters;
39 struct list_head not_waiting;
40};
41typedef struct usbi_cond_t_ usbi_cond_t;
42
43// We *were* getting timespec from pthread.h:
44#if (!defined(HAVE_STRUCT_TIMESPEC) && !defined(_TIMESPEC_DEFINED))
45#define HAVE_STRUCT_TIMESPEC 1
46#define _TIMESPEC_DEFINED 1
47struct timespec {
48 long tv_sec;
49 long tv_nsec;
50};
51#endif /* HAVE_STRUCT_TIMESPEC | _TIMESPEC_DEFINED */
52
53// We *were* getting ETIMEDOUT from pthread.h:
54#ifndef ETIMEDOUT
55# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
56#endif
57
58#define usbi_mutexattr_t void
59#define usbi_condattr_t void
60
61
62int usbi_mutex_static_lock(usbi_mutex_static_t *mutex);
63int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex);
64
65
66int usbi_mutex_init(usbi_mutex_t *mutex,
67 const usbi_mutexattr_t *attr);
68int usbi_mutex_lock(usbi_mutex_t *mutex);
69int usbi_mutex_unlock(usbi_mutex_t *mutex);
70int usbi_mutex_trylock(usbi_mutex_t *mutex);
71int usbi_mutex_destroy(usbi_mutex_t *mutex);
72
73int usbi_cond_init(usbi_cond_t *cond,
74 const usbi_condattr_t *attr);
75int usbi_cond_destroy(usbi_cond_t *cond);
76int usbi_cond_wait(usbi_cond_t *cond, usbi_mutex_t *mutex);
77int usbi_cond_timedwait(usbi_cond_t *cond,
78 usbi_mutex_t *mutex,
79 const struct timespec *abstime);
80int usbi_cond_broadcast(usbi_cond_t *cond);
81int usbi_cond_signal(usbi_cond_t *cond);
82
83#endif /* __LIBUSB_THREADS_WINDOWS_H__ */
84