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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:12:41+00:00 2026-05-29T06:12:41+00:00

If I have: def EventCheck(): if cond_1 == True: do small action if cond_2

  • 0

If I have:

def EventCheck():

    if cond_1 == True:
        do small action

    if cond_2 == True:
         do small action

    if cond_3 == True:
         for i in range(20):
            do longer action multiple times

    if cond_4 == True:
        do small action

    if cond_5 == True:
        do small action


while true:
    eventCheck()

In my theoretical program normal flow control would be along the lines of fig. a in the picture

Is it possible to fork the actual control of the program so if a specific event evaluates as true it then branches of and runs its function while the rest of the program continues on as normal? As in Fig. b above.

In my main ‘event’ loop, I have a condition that is rarely ever true, but when it is, I need it to go off an perform a semi-long task. Right now, it of course takes control of the program so while condition A is running it’s code, none of the other main, frequently used events are able to be checked for.

Is this possible?

  • 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-29T06:12:42+00:00Added an answer on May 29, 2026 at 6:12 am

    Check out multiprocessing.

    If the longer task is I/O bound (instead of CPU) there are some other solutions, like event-driven / async libraries and threading. These don’t offer actual sequential code execution, but instead execute other code while I/O is being done. For a better understanding of choosing multiprocessing vs shared memory models like threading, read up on Python’s GIL.

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

Sidebar

Related Questions

Right now I have def min(array,starting,ending) minimum = starting for i in starting+1 ..ending
How do I put off attribute access in Python? Let's assume we have: def
I have the .def file, .lib file, the .dll, the source files. It's using
I have this code: def setVelocity (x, y, yaw) setVelocity (Command2d.new(x,y,yaw)) end def setVelocity
Say I have a vector: (def data [Hello World Test This]) And I want
In my django views i have the following def create(request): query=header.objects.filter(id=a)[0] a=query.criteria_set.all() logging.debug(a.details) I
I am writing a script and in my script I have this function: def
I have a private method def __pickSide(self): in a parent class that I would
I have code: class Scene def initialize(number) @number = number end attr_reader :number end
I have this test case def setUp(self): self.user = User.objects.create(username=tauri, password='gaul') def test_loginin_student_control_panel(self): c

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.