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 3610552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:45:59+00:00 2026-05-18T21:45:59+00:00

I have an object that is to perform an action, and then sleep for

  • 0

I have an object that is to perform an action, and then sleep for 1 second before performing the action again. However, the object has variables that need to be accessible at all times regardless if it is in its one second sleep period. Is when the object’s execution is suspended, are its variables inaccessible?

This is Python.

Thanks.

EDIT 1:
Clarifying ‘inaccessible’:

Object A has variable x that Object B needs to access repeatedly.
Object A sleeps for 1 second. Will there be a problem if Object B tries to use x while A is sleeping?

EDIT 2:
Forgot to mention the two objects are running as individual processes (I’m using processes to avoid the GIL)

EDIT 3:

class QueueController(Process):
    def __init__(self):
        Process.__init__(self)
        self.queue_stream    = Queue()
        self.queue_language  = Queue()
        self.queue_expander  = Queue()
        self.queue_feature   = Queue()
        self.queue_classify  = Queue()
        self.db = connect_to_db()

    def run(self):
        # Every second, allow 10 more tweets from the raw_tweets db
        # enter the queue_stream to be processed
        value = 0
        while True:
            for i in db.raw_tweets.find().skip(value).limit(30):
                self.queue_stream.put(i)
                value+=30
                sleep(1)

Will another object who uses this QueueController class still be able to use the ‘queues_’ variables even when it sleeps for one second? I’m afraid that sleeping stops execution, but also access to those queue_ variables as a side affect.

  • 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-05-18T21:46:00+00:00Added an answer on May 18, 2026 at 9:46 pm

    time.sleep() does release the GIL, so other threads will be allowed to run.

    The reason I give this answer instead of answering the question you’ve asked is that the question you’ve asked makes no sense. No access is ever prevented other than the ability for other threads to run.

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

Sidebar

Related Questions

I have a small WinForms app that utilizes a BackgroundWorker object to perform a
I have two tables: object that has object_id column and avalues that have object_id
I have an object that cannot be copied, a NetGame because it has a
I have an object that has pairs of replacement values used for simple encoding
I have an object that I convert into NSData using an NSKeyedArchiver and then
I have an object that has properties, but when I try to access them,
I have an object that looks like this { AF : { name :
I have an object that returns a value if successful and false (or nil)
I have an object that travels on the screen and I was just wondering
I have some object that's been added to the body of my page via

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.