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

  • SEARCH
  • Home
  • 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 8857387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:34:38+00:00 2026-06-14T14:34:38+00:00

I have a multi-threaded SMTP server. Each thread takes care of one client. I

  • 0

I have a multi-threaded SMTP server. Each thread takes care of one client. I need to set a timeout value of 10 seconds on each server thread to terminate dormant or misbehaving clients.
I have used the time.time(), to find the start time and my checkpoint time and the difference gives the running time. But I believe it gives the system time and not the time this thread was running.
Is there a Thread local timer API in Python ?

   import threading
   stop = 0

   def hello():
     stop = 1

   t=threading.Timer(10,hello)
   t.start()
   while stop != 1:
      print stop
   print "stop changed"

This prints 0 (initial stop) in a loop and does not come out of the while loop.

  • 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-14T14:34:39+00:00Added an answer on June 14, 2026 at 2:34 pm

    In the python documentation there is no mention of “thread timing”. Either the clocks are process-wide or system-wide. In particular time.clock measures process time while time.time returns the system time.

    In python3.3 the timings API was revised and improved but still, I can’t see any timer that would return the process time taken by a single thread.

    Also note that even if possible it’s not at all easy to write such a timer.
    Timers are OS specific, so you would have to write a different version of the module for every OS. If you want to profile a specific action, just launch it without threads.
    When threaded the timing either it runs as expected, or it is a lot slower because of the OS, in which case you can’t do nothing about it(at least, if you don’t want to write a patch that “fixes” the GIL or removes it safely).

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

Sidebar

Related Questions

I have a multi-threaded application written in Python in which one thread takes care
I have a multi threaded client server application which uses Sockets. When a new
In our system we have multi-threaded processing engine. During processing each thread calls methods
I have a multi-threaded server that handles client requests, and makes new threads for
I have a multi-threaded program, where I have one thread to watch over several
I have a multi threaded application which has one producer thread and several consumer
This is the strangest thing! I have a multi-threaded client application written in Python.
Possible Duplicate: Is stl vector concurrent read thread-safe? I have a multi-threaded program that
I have a multi-threaded application with (4) thread i want to know how much
I have a multi-threaded, multi-server web application with hibernate and spring managing transactions with

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.