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

Re^6: A new CB reader

by Tux (Canon)
on Jul 12, 2019 at 15:18 UTC ( [id://11102739]=note: print w/replies, xml ) Need Help??


in reply to Re^5: A new CB reader
in thread A new CB reader

All of your changes have been merged to my fork of pm-cb, which supports config files ($HOME/pm-cb.rc, $HOME/.pm-cbrc and/or $HOME/.config/pm-cb)


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^7: A new CB reader
by choroba (Cardinal) on Jul 12, 2019 at 21:03 UTC
    Thank you! I tried to integrate the changes in my way. Please verify it works on MSWin, too. Is the QUIT signal still needed? Using MCE::Child makes quitting a bit slower, as all the messages in the queue must be processed first, but otherwise, it should work the same way as the other options.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Signal handling is not necessary. I did that due to MCE::Channel lacking the insert method. Ah, your branch adds an insert wrapper calling enqueue :). That's a clever way calling insert when available.

Re^7: A new CB reader
by marioroy (Prior) on Jul 13, 2019 at 01:45 UTC

    Hi Tux,

    In truth, I never imagined for pm-cb-g to support both the -m and -M options. The reason I tested pm-cb-g using MCE::Child was for testing the 3 together Tk, MCE::Child, and MCE::Channel on Windows, Linux, and macOS.

    Using MCE::Hobo / MCE::Shared. Notice the extra shared-manager process.

    $ ps -e | grep perl 68028 ttys001 0:00.32 perl -I../test_mce pm-cb-g -m # main process 68029 ttys001 0:00.01 perl -I../test_mce pm-cb-g -m # shared mgr 68030 ttys001 0:00.01 perl -I../test_mce pm-cb-g -m # control 68031 ttys001 0:00.09 perl -I../test_mce pm-cb-g -m # communicate

    Using MCE::Child / MCE::Channel.

    $ ps -e | grep perl 68035 ttys001 0:00.29 perl -I../test_mce pm-cb-g -M # main process 68036 ttys001 0:00.01 perl -I../test_mce pm-cb-g -M # control 68037 ttys001 0:00.09 perl -I../test_mce pm-cb-g -M # communicate

    Off-topic

    Q. Why was MCE::Hobo created?

    A. At the time, I wanted a threads-like parallel module to be included with MCE::Shared. It was also helpful for intense testing of MCE::Shared.

    Q. Why did I create MCE::Child years later?

    A. Well, MCE::Channel is new and included with MCE 1.841. I needed something to complement it including running on Perl 5.8. So, I tried making another threads-like parallel module. MCE::Child uses a common MCE::Channel object for IPC versus IPC handled by the shared-manager process. After several attempts, got it to work including running on the Windows platform.

    Q. Which one to choose?

    A. MCE::Child is lighter versus MCE::Hobo because not involving the shared-manager process. However, for apps that have shared variables (i.e. shared array, hash, scalar, etc.), then continue using MCE::Hobo. It's a moot point if the shared-manger is already running.

    Q. What about MCE::Channel->new versus MCE::Shared->queue?

    A. MCE::Channel involves no manager process and behaves very much like a pipe. It eliminates any concerns for Producer(s) running faster than Consumers. For MCE::Shared, items appended to a shared queue are sent to the shared-manager process where the data resides (i.e. in memory). This means the possibility for Producer(s) to run faster than Consumers. But no worries, MCE::Shared::Queue includes the await method for throttling if ever needed.

    Regards, Mario

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found