Coder Social home page Coder Social logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
The feature sounds interesting enough, but I would worry about the interface. 

See src/pdsh/dsh.c:_handle_sigint() and _handle_sigtstp() for examples on how 
simple
signals are currently handled in pdsh (a single SIGINT displays state of active 
threads, another SIGINT within 1s cancels all threads, a SIGTSTP within 1s of 
SIGINT
cancels all pending threads)

You could experiment with SIGUSR1/2 signals that increment/decrement 
opt->fanout (you'd need to first somehow get access to `opt' globally in dsh.c) 
However, this means that you'd need to signal this pdsh thread from an external 
process, which isn't exactly a nice interface.

It would be nice to have the single Ctrl-C put pdsh into a "command mode" 
momentarily, where this and other features could be implement without relying on
signals. However, that might be a bit of work, and probably not worth it for 
pdsh
at this time.

Original comment by [email protected] on 10 Jul 2014 at 1:59

  • Changed state: Accepted

from pdsh.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
https://gist.github.com/dwatzke/96bb88d527acf279ecd2

This is obviously horribly hackish but it is a bare minimum needed to make my 
suggestion work. With this unholy patch, you can use SIGUSR1 to decrement 
fanout value and SIGUSR2 to increment it.

Original comment by [email protected] on 12 Jul 2014 at 5:35

Attachments:

from pdsh.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
I've modified the gist (the url above) so that after a fanout increase 
'pthread_cond_signal(&threadcount_cond)' is called and therefore a new thread 
is spawned immediately

Original comment by [email protected] on 16 Jul 2014 at 7:18

from pdsh.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
This is cool that you got the feature working. In its current form I'm not sure 
I'd be able to pull it into the main pdsh codebase however. What would work is 
if we somehow found a way to enhance the mode after a single Ctrl-C so that 
pdsh accepts new commands. For example you would hit Ctrl-C, then within 1s a 
`f' to change fanout, then a new fanout number... This would resolve the 
yuckiness with using signals.

Also, I'm pretty sure use of pthread_cond_signal() from a signal handler is not 
safe (if you are doing it that way) See:

 http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cond_broadcast.html

However, there may be some way to work around that with your example.


Original comment by [email protected] on 16 Jul 2014 at 1:14

from pdsh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.