Jeremy White wrote:
[edited]
Does anyone know why the system hangs with no reaction if I use
  sleep 10;
in a Win_OnTimer subroutine?

The system hangs because it's sleeping:) Basically, your app isn't processing any events, therefore giving the impression that it's hung.

If I want to create a program that downloads periodically something and save into afile, then periodically gets the data from that
>> file and displays it, is it absolutely necessary to use fork() or
>> threads? (and if yes, which of them do you recommend?)

If you want to avoid the impression that your app has hung - yes. Don't use fork, use threads. Use the latest version of Win32-GUI (it's thread safe) and use the latest version of Perl you can - 5.8.7 and beyond.

I've not played with fork() - but on Win32 platforms it is implemented sing threads anyway. I agree with Jeremy that threads is the way to go. The 1.03 release of Win32::GUI is NOT, as is, threadsafe - there has been plenty of discussion on this list (and the hackers list) in the past - and if it easy to cash perl when threads terminate - search the archives if you're interested.

You can get an experimental module (Win32::GUI::ThreadUtils) that will make thing pretty much thread-safe, as well as some other inter-thread-comms features specific to Win32::GUI - from http://www.robmay.me.uk/win32gui/. I hope to integrate this into the next Win32::GUI release.

Regards,
Rob.

Reply via email to