CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [samir.gambler] Need to implement threading concept: Edit Log



histrung
Novice

Feb 1, 2012, 12:59 PM


Views: 1851
Re: [samir.gambler] Need to implement threading concept

Change

Code
# Bad 
use Thread qw(async);

to

Code
 # Good 
use threads qw(async);

Without this change it did exactly what you described. I have perl v5.8.8.8 and it worked for me.
Also, you should add a usleep to your checking thread, otherwise it will consume a large amount of CPU


Code
use Time::HiRes qw(usleep); 
# Sleep 0.00025 seconds or whatever you want
usleep(250);

Note:
(Prior to Perl 5.8, 5005threads was available through the Thread.pm API. This threading model has been deprecated, and was removed as of Perl 5.10.0.)


(This post was edited by histrung on Feb 1, 2012, 2:18 PM)


Edit Log:
Post edited by histrung (Novice) on Feb 1, 2012, 2:18 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives