Win32 multithreading problems

Why is this happening? The technique of processing all events in a
second thread works fine under Linux.
I’m now thinking about swapping the threads, just processing the events
in the original one and running the game in a second one…

As explained in the other message, there’s no way of accessing the
event queue for the window from another thread, or transferring ownership
of the window to another thread (if this isn’t the case, PLEASE let know! :slight_smile:
As I mentioned, there is a way, to do this. The function is called
AttachThreadInput and pipes the complete message loop to another thread:

BOOL AttachThreadInput(
DWORD idAttach, // ID of thread to be chown
DWORD idAttachTo, // ID of thread to recieve the input
BOOL fAttach // establish or destroy the pipe?
);

Don’t know, if that solves the mentioned problem internally, but this should
be at least an attempt.

Regards,
Andreas PodgurskiOn Tue, 17 Oct 2000 16:46:05 -0700, Sam Lantinga wrote:

Hi,

I’m currently trying to port ASC to Windows using Watcom C/C++. The
problem I have is that quite a lot of things that are usually handled
by Windows and SDL without having to care about don’t work when I’m
calling SDL_PollEvent from a second thread. These things include:

  • moving the window around
  • pressing the icons in the title bar
  • redrawing the window if I move it from background to foreground

I’ve modified the testsprite program to show the effect:
www.asc-hq.org/testsprite2.c

Why is this happening? The technique of processing all events in a
second thread works fine under Linux.

Since I haven’t succeeded in compiling the SDL.DLL with Watcom myself,
I’m using the precompiled one from the SDL homepage ( version 1.1.5 ).

Bye,
Martin