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:
Rémi Bernon 2021-08-30 11:22:51 +02:00 committed by Alexandre Julliard
parent d22ece4c58
commit f6d567d3e3
2 changed files with 22 additions and 1 deletions

View File

@ -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));

View File

@ -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,