Any examples of non-blocking delay functions in c on IRIX?

KayBee

Active member
Feb 24, 2020
147
114
43
Hi All,

On Arduino (my hacky C background) there is a function called millis(); that can be used to delay a frame of animation or a blinking LED. There are also examples of Libraries that allow actions to occur every n frames. Anyone have examples of a similar concept on IRIX c?

Thank you as always.

KB
 
Last edited:
That's not how C works...
There's no concept of frames or the ability to run something after some time via a callback anything like that. There's just code that runs start to finish by default.

The C way of doing something like that is to start up a background thread (look up pthreads) and that thread can delay for a set amount of time (which will be blocking...but only blocking that thread) and then either run whatever code, or message back to the main thread that is apparently doing...something else given you don't want it blocked.
 
Hi All,

On Arduino (my hacky C background) there is a function called millis(); that can be used to delay a frame of animation or a blinking LED. There are also examples of Libraries that allow actions to occur every n frames. Anyone have examples of a similar concept on IRIX c?

Thank you as always.

KB

hi

you may want to take a look at alarm() function.

My second bet would be threads as already mentioned.

Third option is to use a library that does all this behind the scene. Libevent, glib and libboost come to mind.
 
That's not how C works...
There's no concept of frames or the ability to run something after some time via a callback anything like that. There's just code that runs start to finish by default.

The C way of doing something like that is to start up a background thread (look up pthreads) and that thread can delay for a set amount of time (which will be blocking...but only blocking that thread) and then either run whatever code, or message back to the main thread that is apparently doing...something else given you don't want it blocked.

Thank you Dr. Madison, I will look into pthreads, which SGI .pdfs would that be part of? I looked in the SGI C annual:
007-0701-120 and there is no mention.

Thanks again.

KB
 
hi

you may want to take a look at alarm() function.

My second bet would be threads as already mentioned.

Third option is to use a library that does all this behind the scene. Libevent, glib and libboost come to mind.

Hi Tru,

I thank you as well for your response. Which SGI documentation covers "alert()?"
I have checked the SGI C language reference and there is no mention. (version 007-0701-120)

If you can point me in a direction for a manual I will give it a read.

Thanks for taking the time.

KB
 
pthreads is a posix thing so you can honestly just google it (it's not SGI specific so easy to find examples online)
 
Hi Tru,

I thank you as well for your response. Which SGI documentation covers "alert()?"
I have checked the SGI C language reference and there is no mention. (version 007-0701-120)

If you can point me in a direction for a manual I will give it a read.

Thanks for taking the time.

KB
"man alarm" in an irix terminal should do the trick
 

About us

  • Silicon Graphics User Group (SGUG) is a community for users, developers, and admirers of Silicon Graphics (SGI) products. We aim to be a friendly hobbyist community for discussing all aspects of SGIs, including use, software development, the IRIX Operating System, and troubleshooting, as well as facilitating hardware exchange.

User Menu