Assuming 2 parallel threads (duh!) is it thread-safe for them to send messages to the same window without a mutex lock, like for changing the title and size on the window at the same time?
Assuming 2 parallel threads (duh!) is it thread-safe for them to send messages to the same window without a mutex lock, like for changing the title and size on the window at the same time?
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Yes, but be careful of deadlocks.
I got some random troubles but using SendMessageTimeout instead of SendMessage seemed to solve it.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
This will probably sound like a stupid question, but in MSVC I still compile as Runtime Library - Single Threaded. Should I change to multi-threaded? Isn't winapi threadsafe without it?
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
The WinAPI is independent of the runtime library, but you should use the multi-threaded runtime library if you are using C or C++ library functions. Several of the C/C++ functions use static data (rand, localtime, etc), which would create havoc if you used the single thread runtime library in a multi-threaded environment.
And in MSVC 2005 .NET the single-threaded libraries are no longer an option.