Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi Discipulus. Just few line changes ( 3 places ). Here's the diff output.

$ diff pm-cb-g pm-cb-g-hobo 27,28c27,28 < use threads (stack_size => 2 ** $stack_size); < use Thread::Queue; --- > use MCE::Hobo; > use MCE::Shared; 41c41 < my ($readQ, $writeQ) = map 'Thread::Queue'->new, 1, 2; --- > my ($readQ, $writeQ) = map { MCE::Shared->queue() } 1, 2; 43c43 < my $communicate_t = threads->create(\&communicate); --- > my $communicate_t = MCE::Hobo->create(\&communicate);

Update. The stack_size option isn't needed when using MCE::Hobo. Below is the diff -u output.

$ diff -u pm-cb-g pm-cb-g-hobo --- pm-cb-g 2017-07-07 16:05:39.000000000 -0500 +++ pm-cb-g-hobo 2017-07-07 16:32:36.782646208 -0500 @@ -6,12 +6,11 @@ use Getopt::Long qw( :config no_ignore_case ); -my ($bg_color, $fg_color, $author_color, $font_name, $char_size, - $stack_size); +my ($bg_color, $fg_color, $author_color, $font_name, $char_size); BEGIN { ($bg_color, $fg_color, $author_color, $font_name, $char_size, - $stack_size) = qw( white black blue Helvetica 12 15 ); + ) = qw( white black blue Helvetica 12 ); die "Invalid arguments!\n" unless GetOptions( 'a|author_color=s' => \$author_color, @@ -19,13 +18,12 @@ 'c|char_size=i' => \$char_size, 'f|fg_color=s' => \$fg_color, 'F|font_name=s' => \$font_name, - 's|stack_size=i' => \$stack_size, ); } -use threads (stack_size => 2 ** $stack_size); -use Thread::Queue; +use MCE::Hobo; +use MCE::Shared; use constant { @@ -38,9 +36,9 @@ }; -my ($readQ, $writeQ) = map 'Thread::Queue'->new, 1, 2; +my ($readQ, $writeQ) = map { MCE::Shared->queue() } 1, 2; -my $communicate_t = threads->create(\&communicate); +my $communicate_t = MCE::Hobo->create(\&communicate); gui();

Regards, Mario


In reply to Re^3: A new CB reader by marioroy
in thread A new CB reader by choroba

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found