Commit f6d567d3 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winebus.sys: Pass a struct bus_event pointer to bus_wait.

Allocated on the caller side. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d22ece4c
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment