Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: multi threading

by renodino (Curate)
on Feb 29, 2008 at 16:16 UTC ( #671203=note: print w/replies, xml ) Need Help??


in reply to multi threading

some kinda synchronized processing

Er...threads have enough problems with non-deterministic behavior, you might want to refine that "requirement" a bit ?

And I spotted a rather gruesome wart in the midst of your example: invoking

system("date")
from inside a thread is not exactly best practice (you do realize system() turns into a fork()?). Consider using
print "test\n", scalar localtime(), "\n";
instead.

Of course, making that edit changes the whole behavior of the threads: since its much faster, many threads will complete before other threads have even been started...so its not exactly simultaneous.

As BrowserUk mentioned, look into lock() and cond_wait().


Perl Contrarian & SQL fanboy

Replies are listed 'Best First'.
Re^2: multi threading
by mude (Novice) on Mar 01, 2008 at 10:48 UTC

    thank you... ill change it.....

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://671203]
help
Chatterbox?
[marto]: Wolfsbane , now I'm having flashbacks
[choroba]: Isn't Using PerlPod Creatively rather a meditation?
[choroba]: I don't see a question
[1nickt]: ugh, I stuck my head in the bass bin for 30 seconds on a dare at Ted Nugent at Hammersmith Odeon. Yes, I am 40% deaf now.
[johngg]: My daughter is incredibly jealous of my wife who got to see The Clash at Brixton many years ago. They went to see The Vaccines there recently.
[1nickt]: But the bands are even louder! I saw Spearhead (Michael Franti) at an outdoor show and had to walk a mile away to not feel pain in my chest! Babies were crying ... I asked the sound engineer why it was necessary to have the bass so loud and he laughed...
[Discipulus]: but the best i attended live was Mano Negra Patchanka at Forte Prenestino .. in 1990

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-03-24 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.