Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: threads, file handles and wxPerl

by zentara (Archbishop)
on Feb 17, 2013 at 13:10 UTC ( #1019131=note: print w/ replies, xml ) Need Help??


in reply to threads, file handles and wxPerl

Hi, as BrowserUk has pointed out, just using the fileno to pass filehandles can be frought with synchronization problems, which as he suggests can be controlled with the use of semaphores. But there is another way, which I wanted to suggest to you just as an idea.

You could make a set of pipes to the thread, and this has the advantage that you can create the pipe in the main thread, and pass the pipe filehandle into the thread at creation time. The advantage to this is that as soon as you create the writer end of the pipe in the thread, you can immediately start writing the output of your thread's IPC3 output into the thread, without dealing with semaphores. See Using Select and pipes to communicate with threads for a simple example. You can probably use Wx's ProcessStream to watch the pipe's input, as I imagine it is like Tk's fileevent.

Just a late thought I wanted to pass on to you. :-)


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh


Comment on Re: threads, file handles and wxPerl

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019131]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (17)
As of 2014-07-24 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (165 votes), past polls