Jeremy White wrote:
A few months back I hinted at some code that Rob had built that would
make threading coding much easier for Win32-GUI apps. In light of your
recent examples, I've dropped him an offlist mail suggesting that his
code be available to more people. Although not complete, it is a great
platform to build from.
One of the problems that Rob's code solves is that one end of a thread
message queue can be attached to a window meaning there are no sleeps or
polling to check for new messages. Basically, it means that a working
thread can fire events in the thread controlling the window, resulting
in a very efficient and simple event driven threading model.
OK, my code is available from http://www.robmay.me.uk/win3gui/ - scroll
to the bottom and find the link for Win32::GUI::ThreadUtils
The zip file contains my Win32::GUI::ThreadUtils, written with
significant input from Jeremy at the end of last year. Also in the zip
file is several README files that hold some basic documentation; and
some example code. The zip file is NOT an installable module
distribution (no time for that right now), just unzip it (it'll create
its own directory to unpack the files into), read the top level README
and run the examples.
It attempts to solve the following problems:
(1) Make Win32::GUI threadsafe, so that you don't have to create all
your threads at the start of your script.
(2) Make the inter-thread communications event based, so there's no
polling required to pass messages between threads.
(3) Hide the gore of needing to know about window handles shared
variables and message queues from the user
Feedback welcome - in my absence I hope that Jeremy might be able to
guide you through the pitfalls, although I've tried to scribble down the
problems that I know about in the README files.
Jason/Emmanuel - you might be interested in looking at the historical
examples in the development directory - you'll see a lot of similarity
between what you posted and the first few examples that I put together.
Regards,
Rob.
--
Robert May - [EMAIL PROTECTED]
Win32::GUI, a perl extension for native Win32 applications
http://perl-win32-gui.sourceforge.net/