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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:47:01+00:00 2026-05-30T13:47:01+00:00

On the allegro wiki(http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Events) it shows this code. bool get_event = al_wait_for_event_until(event_queue, &ev, &timeout);

  • 0

On the allegro wiki(http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Events) it shows this code.

    bool get_event = al_wait_for_event_until(event_queue, &ev, &timeout);

I get what the code does but why wait for an event or until 60 milliseconds is up? WHy not just one or the other?

  • 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-30T13:47:02+00:00Added an answer on May 30, 2026 at 1:47 pm

    The question is answered by asking a simple question: what happens if the event never comes? Do you want your program to sit there waiting on something that won’t happen?

    Some events are more or less guaranteed to happen; them not happening means that bad things are going on. Not getting the v-sync event means that the display no longer exists. Or something. Not getting a timer event means that the Allegro timer system is broken (or someone set the timer to a really long duration). But some events may not happen at all.

    The timeout is there in case the event is never fired. That way, you can detect it (via the return value) and do something about it.

    What so bad about just waiting forever until an event comes?

    Because a program needs to be responsive. Presumably you’re using the Allegro Game Programming library to make a game.

    Do you really want your game to stop for 2 minutes because of some event? Do you want your display to sit frozen on an image for 5 minutes, with the user not knowing what’s going on? Or do you want to be able to pop up a dialog box saying, “Hey, I’m waiting for something. Hold on a bit.” And then display an animated wait cursor.

    Waiting forever is never a good idea.

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

Sidebar

Related Questions

This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives
I'm just trying out the allegro library, and here is the code which I've
So I have this code for these Constructors of the Weapon class: Weapon(const WeaponsDB
I recently compiled Allegro-5.0 from source (following the instructions from the wiki). I didn't
What is the best way to code a game loop in Allegro 5 that
I am trying to set up my code to use the allegro libray, I
I have this code:( BITMAPS is a free name) class BITMAPS{ public: static ALLEGRO_BITMAP
I am trying to install libguichan without allegro support, because allegro will not build
I am trying to setup allegro to work with visual studio express 2008 .
I just finished a 2d platformer in C++/Allegro. Its still in an incomplete stage...

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.