mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 19:53:38 +00:00
winebus.sys: Pass a struct bus_event pointer to bus_wait.
Allocated on the caller side. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d22ece4c58
commit
f6d567d3e3
|
@ -648,6 +648,7 @@ struct bus_main_params
|
|||
HANDLE init_done;
|
||||
unsigned int init_code;
|
||||
unsigned int wait_code;
|
||||
struct bus_event *bus_event;
|
||||
};
|
||||
|
||||
static DWORD CALLBACK bus_main_thread(void *args)
|
||||
|
@ -660,11 +661,13 @@ static DWORD CALLBACK bus_main_thread(void *args)
|
|||
SetEvent(bus.init_done);
|
||||
TRACE("%s main loop started\n", debugstr_w(bus.name));
|
||||
|
||||
bus.bus_event->type = BUS_EVENT_TYPE_NONE;
|
||||
if (status) WARN("%s bus init returned status %#x\n", debugstr_w(bus.name), status);
|
||||
else status = winebus_call(bus.wait_code, NULL);
|
||||
else while ((status = winebus_call(bus.wait_code, bus.bus_event)) == STATUS_PENDING) {}
|
||||
|
||||
if (status) WARN("%s bus wait returned status %#x\n", debugstr_w(bus.name), status);
|
||||
else TRACE("%s main loop exited\n", debugstr_w(bus.name));
|
||||
HeapFree(GetProcessHeap(), 0, bus.bus_event);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -679,6 +682,14 @@ static NTSTATUS bus_main_thread_start(struct bus_main_params *bus)
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if (!(bus->bus_event = HeapAlloc(GetProcessHeap(), 0, sizeof(struct bus_event))))
|
||||
{
|
||||
ERR("failed to allocate %s bus event.\n", debugstr_w(bus->name));
|
||||
CloseHandle(bus->init_done);
|
||||
bus_count--;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if (!(bus_thread[i] = CreateThread(NULL, 0, bus_main_thread, bus, 0, NULL)))
|
||||
{
|
||||
ERR("failed to create %s bus thread.\n", debugstr_w(bus->name));
|
||||
|
|
|
@ -46,6 +46,16 @@ struct iohid_bus_options
|
|||
|
||||
struct unix_device;
|
||||
|
||||
enum bus_event_type
|
||||
{
|
||||
BUS_EVENT_TYPE_NONE,
|
||||
};
|
||||
|
||||
struct bus_event
|
||||
{
|
||||
enum bus_event_type type;
|
||||
};
|
||||
|
||||
enum unix_funcs
|
||||
{
|
||||
sdl_init,
|
||||
|
|
Loading…
Reference in a new issue