Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8892985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:08:26+00:00 2026-06-14T23:08:26+00:00

Consider a hypothetical threaded Python application that runs each thread in an infinite loop:

  • 0

Consider a hypothetical threaded Python application that runs each thread in an infinite loop:

import signal                                                          
import sys 
import threading
import time

class CallSomebody (threading.Thread):
        def __init__(self, target, *args):
                self._target = target
                self._args = args
                threading.Thread.__init__(self)

        def run (self):
                self._target(*self._args)

def call (who):
        while True:
                print "Who you gonna call? %s" % (str(who))



def signal_handler(signal, frame):
    sys.exit(0)

signal.signal(signal.SIGINT, signal_handler)



a=CallSomebody(call, 'Ghostbusters!')
a.daemon=True

b=CallSomebody(call, 'The Exorcist!')
b.daemon=True

a.start()
b.start()

a.join()
b.join()

When running the application, sending SIGINT by pressing CtrlC does not stop the application. I tried removing the daemon statements but that did not help. What fundamental idea am I missing?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:08:27+00:00Added an answer on June 14, 2026 at 11:08 pm

    When you join a thread the active thread blocks until the joined thread returns. Yours never do. You won’t want to join them in this way.

    Generally, background threads that are daemon threads and that perform infinite loops should be marked daemon, never joined, and then allowed to expire when your main thread does so. If you happened to be using wx for example, you’d make your call to AppInstance.MainLoop() after starting the daemonic threads, then when your Frame or whatever other top level instances you had were closed, the program execution would be concluded, and the daemons would be addressed appropriately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the hypothetical function repeatcall , that takes as arguments a no-args callable func
Consider the following hypothetical people management system. Suppose each Person object belong to a
Consider a hypothetical method of an object that does stuff for you: public class
This question requires some hypothetical background. Let's consider an employee table that has columns
Consider the following two (hypothetical) tables Temperature * day * time * lake_name *
This is kind of hypothetical as I'm thinking about how to design this. Consider
(This is a hypothetical question for discussion, I have no actual problem). Say that
Consider an ASP.NET Web API service that redirects public class ThisController : ApiController {
I'd like to get some advice on database design. Specifically, consider the following (hypothetical)
Consider this hypothetical implementation of vector : template<class T> // ignore the allocator struct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.