| Bryan Balfour 2005-07-25, 5:30 pm |
| Expanding on my original question;
The core of my application is a wait loop that waits on the 'work
queue' (Thread::Queue) upon which 'work-units' are enqueued. A
'work-unit' is an instance of my "WorkUnit" class in which the data
relevant to that 'work-unit' is stored.
Prior to dropping into this wait loop, my application creates a new
instance of a class responsible for capturing a line of keyboard input,
loading it into a new work-unit and queuing this work unit onto the
'work queue'.
This is achieved asynchronously by the constructor of this class
creating a new thread (which is then detached). The parameters passed
to this class on the constructor are references to the 'work queue',
the locking flag and the wait/pulse event.
When this application runs, work-units containing keyboard input are
successfully queued in the 'keyboard input' thread. The problem is that
when these work-units are dequeued in the wait loop, they are empty.
The 'ref' function returns "WorkUnit" as their type but they have not
been initialised so I'm getting 'uninitialised value' errors when I try
to retrieve the 'work-unit' data.
Other points that may be relevant are:
- I'm running Perl 5.8.6 under WindowsXP
- My main application uses the following classes:
Thread qw(async);
Thread::Queue;
Thread::Semaphore;
Win32::Event;
- I don't really understand how Perl works.
Hope this helps.
Bryan
|