Giter Site home page Giter Site logo

Fix signal handler about catimg HOT 9 CLOSED

posva avatar posva commented on May 22, 2024
Fix signal handler

from catimg.

Comments (9)

posva avatar posva commented on May 22, 2024

I intentionally check it after each loop so an image doesn't get half printed
I'm afraid your knowledge is way higher than mine and that I cannot see what will this bring to catimg. I really appreciate it as I'm learning many interesting things but I cannot see any any benefit from using the sig_atomic_t. To me this seems a bit overkill.
However if you change the code, create a PR and prove the code have been improved in efficiency or in error handling, I'll merge it.

I'm going to add an option for the number of loops so that line will be needed

from catimg.

elfring avatar elfring commented on May 22, 2024

… I cannot see any any benefit from using the sig_atomic_t.

The reuse of this data type is one of the preferred ways for the portable data exchange with your signal handler. How do you think about to improve software portability a bit here?

An other software design option would be to delegate signal handling or the image file processing to another thread, wouldn't it?

from catimg.

posva avatar posva commented on May 22, 2024

ok for the portability. Having multiple threads for catimg just to handle the sigterm or any other signal is overkill, don't you think 😅

from catimg.

elfring avatar elfring commented on May 22, 2024

Having multiple threads for catimg just to handle the sigterm or any other signal is overkill, …

It depends on user expectations for your software application. In which time frame would you like to see the appropriate response for the event "SIGINT"?

from catimg.

posva avatar posva commented on May 22, 2024

It depends on user expectations for your software application

Well, nobody complained about it yet.

In which time frame would you like to see the appropriate response for the event "SIGINT"?

At the end of an image/frame for a GIF and anytime for a normal image. Although this may vary on the terminal size. I guess I'll etablish a pixel count. I'll run some test and call the handler after that many pixels are displayed

from catimg.

elfring avatar elfring commented on May 22, 2024

I guess I'll etablish a pixel count.

Is such an approach really needed?
Will an immediate reaction be usually more appropriate?

from catimg.

posva avatar posva commented on May 22, 2024

nope, as I said in the first comment

from catimg.

elfring avatar elfring commented on May 22, 2024

I assume that there are users who will not like delayed signal handling.

Can the portable data type "sig_atomic_t" be applied at least?

from catimg.

posva avatar posva commented on May 22, 2024

I'll see, thanks 😄

from catimg.

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.