Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
cc2f6693
Commit
cc2f6693
authored
Sep 17, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Use a pthread_mutex_t instead of CRITICAL_SECTION.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8f6932fd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
46 deletions
+30
-46
Makefile.in
dlls/winebus.sys/Makefile.in
+1
-1
bus_iohid.c
dlls/winebus.sys/bus_iohid.c
+7
-12
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+7
-13
bus_udev.c
dlls/winebus.sys/bus_udev.c
+15
-20
No files found.
dlls/winebus.sys/Makefile.in
View file @
cc2f6693
MODULE
=
winebus.sys
IMPORTS
=
ntoskrnl advapi32
EXTRALIBS
=
$(IOKIT_LIBS)
$(UDEV_LIBS)
EXTRALIBS
=
$(IOKIT_LIBS)
$(UDEV_LIBS)
$(PTHREAD_LIBS)
EXTRAINCL
=
$(UDEV_CFLAGS)
$(SDL2_CFLAGS)
EXTRADLLFLAGS
=
-mno-cygwin
-Wl
,--subsystem,native
...
...
dlls/winebus.sys/bus_iohid.c
View file @
cc2f6693
...
...
@@ -83,6 +83,8 @@
#undef PAGE_SHIFT
#endif
/* HAVE_IOKIT_HID_IOHIDLIB_H */
#include <pthread.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -98,14 +100,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
plugplay
);
#ifdef HAVE_IOHIDMANAGERCREATE
static
CRITICAL_SECTION
iohid_cs
;
static
CRITICAL_SECTION_DEBUG
iohid_cs_debug
=
{
0
,
0
,
&
iohid_cs
,
{
&
iohid_cs_debug
.
ProcessLocksList
,
&
iohid_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": iohid_cs"
)
}
};
static
CRITICAL_SECTION
iohid_cs
=
{
&
iohid_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
pthread_mutex_t
iohid_cs
=
PTHREAD_MUTEX_INITIALIZER
;
static
IOHIDManagerRef
hid_manager
;
static
CFRunLoopRef
run_loop
;
...
...
@@ -184,9 +179,9 @@ static void iohid_device_stop(struct unix_device *iface)
IOHIDDeviceRegisterInputReportCallback
(
private
->
device
,
NULL
,
0
,
NULL
,
NULL
);
RtlEnterCriticalSection
(
&
iohid_cs
);
pthread_mutex_lock
(
&
iohid_cs
);
list_remove
(
&
private
->
unix_device
.
entry
);
RtlLeaveCriticalSection
(
&
iohid_cs
);
pthread_mutex_unlock
(
&
iohid_cs
);
}
static
NTSTATUS
iohid_device_get_report_descriptor
(
struct
unix_device
*
iface
,
BYTE
*
buffer
,
...
...
@@ -407,9 +402,9 @@ NTSTATUS WINAPI iohid_bus_wait(void *args)
do
{
if
(
bus_event_queue_pop
(
&
event_queue
,
result
))
return
STATUS_PENDING
;
RtlEnterCriticalSection
(
&
iohid_cs
);
pthread_mutex_lock
(
&
iohid_cs
);
ret
=
CFRunLoopRunInMode
(
kCFRunLoopDefaultMode
,
10
,
TRUE
);
RtlLeaveCriticalSection
(
&
iohid_cs
);
pthread_mutex_unlock
(
&
iohid_cs
);
}
while
(
ret
!=
kCFRunLoopRunStopped
);
TRACE
(
"IOHID main loop exiting
\n
"
);
...
...
dlls/winebus.sys/bus_sdl.c
View file @
cc2f6693
...
...
@@ -35,6 +35,8 @@
# include <SDL.h>
#endif
#include <pthread.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -62,15 +64,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
WINE_DECLARE_DEBUG_CHANNEL
(
hid_report
);
static
CRITICAL_SECTION
sdl_cs
;
static
CRITICAL_SECTION_DEBUG
sdl_cs_debug
=
{
0
,
0
,
&
sdl_cs
,
{
&
sdl_cs_debug
.
ProcessLocksList
,
&
sdl_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": sdl_cs"
)
}
};
static
CRITICAL_SECTION
sdl_cs
=
{
&
sdl_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
pthread_mutex_t
sdl_cs
=
PTHREAD_MUTEX_INITIALIZER
;
static
const
WCHAR
sdl_busidW
[]
=
{
'S'
,
'D'
,
'L'
,
'J'
,
'O'
,
'Y'
,
0
};
static
struct
sdl_bus_options
options
;
...
...
@@ -513,9 +507,9 @@ static void sdl_device_stop(struct unix_device *iface)
if
(
private
->
sdl_controller
)
pSDL_GameControllerClose
(
private
->
sdl_controller
);
if
(
private
->
sdl_haptic
)
pSDL_HapticClose
(
private
->
sdl_haptic
);
RtlEnterCriticalSection
(
&
sdl_cs
);
pthread_mutex_lock
(
&
sdl_cs
);
list_remove
(
&
private
->
unix_device
.
entry
);
RtlLeaveCriticalSection
(
&
sdl_cs
);
pthread_mutex_unlock
(
&
sdl_cs
);
}
static
NTSTATUS
sdl_device_get_reportdescriptor
(
struct
unix_device
*
iface
,
BYTE
*
buffer
,
...
...
@@ -787,7 +781,7 @@ static void process_device_event(SDL_Event *event)
TRACE_
(
hid_report
)(
"Received action %x
\n
"
,
event
->
type
);
RtlEnterCriticalSection
(
&
sdl_cs
);
pthread_mutex_lock
(
&
sdl_cs
);
if
(
event
->
type
==
SDL_JOYDEVICEADDED
)
sdl_add_device
(((
SDL_JoyDeviceEvent
*
)
event
)
->
which
);
...
...
@@ -813,7 +807,7 @@ static void process_device_event(SDL_Event *event)
else
WARN
(
"failed to find device with id %d
\n
"
,
id
);
}
RtlLeaveCriticalSection
(
&
sdl_cs
);
pthread_mutex_unlock
(
&
sdl_cs
);
}
NTSTATUS
WINAPI
sdl_bus_init
(
void
*
args
)
...
...
dlls/winebus.sys/bus_udev.c
View file @
cc2f6693
...
...
@@ -58,6 +58,8 @@
# endif
#endif
#include <pthread.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -91,14 +93,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
WINE_DECLARE_DEBUG_CHANNEL
(
hid_report
);
static
CRITICAL_SECTION
udev_cs
;
static
CRITICAL_SECTION_DEBUG
udev_cs_debug
=
{
0
,
0
,
&
udev_cs
,
{
&
udev_cs_debug
.
ProcessLocksList
,
&
udev_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": udev_cs"
)
}
};
static
CRITICAL_SECTION
udev_cs
=
{
&
udev_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
pthread_mutex_t
udev_cs
=
PTHREAD_MUTEX_INITIALIZER
;
static
struct
udev
*
udev_context
=
NULL
;
static
struct
udev_monitor
*
udev_monitor
;
...
...
@@ -622,9 +617,9 @@ static void hidraw_device_destroy(struct unix_device *iface)
static
NTSTATUS
hidraw_device_start
(
struct
unix_device
*
iface
)
{
RtlEnterCriticalSection
(
&
udev_cs
);
pthread_mutex_lock
(
&
udev_cs
);
start_polling_device
(
iface
);
RtlLeaveCriticalSection
(
&
udev_cs
);
pthread_mutex_unlock
(
&
udev_cs
);
return
STATUS_SUCCESS
;
}
...
...
@@ -632,10 +627,10 @@ static void hidraw_device_stop(struct unix_device *iface)
{
struct
platform_private
*
private
=
impl_from_unix_device
(
iface
);
RtlEnterCriticalSection
(
&
udev_cs
);
pthread_mutex_lock
(
&
udev_cs
);
stop_polling_device
(
iface
);
list_remove
(
&
private
->
unix_device
.
entry
);
RtlLeaveCriticalSection
(
&
udev_cs
);
pthread_mutex_unlock
(
&
udev_cs
);
}
static
NTSTATUS
hidraw_device_get_report_descriptor
(
struct
unix_device
*
iface
,
BYTE
*
buffer
,
...
...
@@ -824,9 +819,9 @@ static NTSTATUS lnxev_device_start(struct unix_device *iface)
if
((
status
=
build_report_descriptor
(
ext
,
ext
->
base
.
udev_device
)))
return
status
;
RtlEnterCriticalSection
(
&
udev_cs
);
pthread_mutex_lock
(
&
udev_cs
);
start_polling_device
(
iface
);
RtlLeaveCriticalSection
(
&
udev_cs
);
pthread_mutex_unlock
(
&
udev_cs
);
return
STATUS_SUCCESS
;
}
...
...
@@ -834,10 +829,10 @@ static void lnxev_device_stop(struct unix_device *iface)
{
struct
wine_input_private
*
ext
=
input_impl_from_unix_device
(
iface
);
RtlEnterCriticalSection
(
&
udev_cs
);
pthread_mutex_lock
(
&
udev_cs
);
stop_polling_device
(
iface
);
list_remove
(
&
ext
->
base
.
unix_device
.
entry
);
RtlLeaveCriticalSection
(
&
udev_cs
);
pthread_mutex_unlock
(
&
udev_cs
);
}
static
NTSTATUS
lnxev_device_get_report_descriptor
(
struct
unix_device
*
iface
,
BYTE
*
buffer
,
...
...
@@ -1246,16 +1241,16 @@ NTSTATUS WINAPI udev_bus_wait(void *args)
{
if
(
bus_event_queue_pop
(
&
event_queue
,
result
))
return
STATUS_PENDING
;
RtlEnterCriticalSection
(
&
udev_cs
);
pthread_mutex_lock
(
&
udev_cs
);
while
(
close_count
--
)
close
(
close_fds
[
close_count
]);
memcpy
(
pfd
,
poll_fds
,
poll_count
*
sizeof
(
*
pfd
));
count
=
poll_count
;
close_count
=
0
;
RtlLeaveCriticalSection
(
&
udev_cs
);
pthread_mutex_unlock
(
&
udev_cs
);
while
(
poll
(
pfd
,
count
,
-
1
)
<=
0
)
{}
RtlEnterCriticalSection
(
&
udev_cs
);
pthread_mutex_lock
(
&
udev_cs
);
if
(
pfd
[
0
].
revents
)
process_monitor_event
(
udev_monitor
);
if
(
pfd
[
1
].
revents
)
read
(
deviceloop_control
[
0
],
&
ctrl
,
1
);
for
(
i
=
2
;
i
<
count
;
++
i
)
...
...
@@ -1264,7 +1259,7 @@ NTSTATUS WINAPI udev_bus_wait(void *args)
device
=
find_device_from_fd
(
pfd
[
i
].
fd
);
if
(
device
)
device
->
read_report
(
&
device
->
unix_device
);
}
RtlLeaveCriticalSection
(
&
udev_cs
);
pthread_mutex_unlock
(
&
udev_cs
);
}
TRACE
(
"UDEV main loop exiting
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment