Sponsored Content
Top Forums Programming How to implement polling for a function using timer in C? Post 302144911 by blowtorch on Sunday 11th of November 2007 10:53:24 PM
Old 11-11-2007
Use alarm(2) to set an alarm for 30 sec. When the timer runs out, a SIGALRM will be sent to your process. Catch that signal, do what you want, then set the alarm(2) again. Keep doing ad infinitum.
 

10 More Discussions You Might Find Interesting

1. Programming

Help - Polling Script

How do I write a shell script to perform polling just like what happens with Microsoft mail. i.e display an alert box. (1 Reply)
Discussion started by: brianmu
1 Replies

2. AIX

how to implement timer

anyone can help me how to implement the timer on AIX? I tried with 'setitimer' and its related functions, but it does not work correctly,the program exited each time. thanks (2 Replies)
Discussion started by: Frank2004
2 Replies

3. Shell Programming and Scripting

Want to implement VLOOKUP (Excel function) in Unix

Dear All, i want to implement vookup function which is there in excel into Unix. Suppose i have 2 files. The files are given below. File1: MSC Cell SDCA Patna-1 12 Bihar Patna-2 45 Ranchi Bhopal-1 85 Raigarh Bhopal-2 ... (8 Replies)
Discussion started by: pravani1
8 Replies

4. UNIX for Advanced & Expert Users

How to avoid polling???

Hi all, I have a directory where some process is keeping incremental/new log files. I need to code a program which will periodically poll this directory and if it founds a new file arrived then copy that new file to some other specific directory. We are OK with this polling approach. I just... (3 Replies)
Discussion started by: zing_foru
3 Replies

5. Solaris

NTP polling interval

Is it possible to change the ntp poll manually. I notice that ntp poll is changing autimatically. (1 Reply)
Discussion started by: ningy
1 Replies

6. Programming

Db polling...

Hi! Im trying to make a program that polls a mysqlDB every 5 minutes. the poll checks a scheduletable in the dB and exicutes a function if there was a "go" in the scheduletable, and if it retrives a "no go" from the table it should just wait for another 5 minutes before re polling the DB, ... (1 Reply)
Discussion started by: karlblau
1 Replies

7. HP-UX

Polling target on Serviceguard

Hi Guys, we are planning to enable polling target on our SG in reference to this link MC/ServiceGuard: Subnet Goes Down when one of the Cluster Node is Down - HP Customer Care (United States - English) since our server is already in production can we apply the changes with ex. "cmapplyconf... (1 Reply)
Discussion started by: batas
1 Replies

8. UNIX for Dummies Questions & Answers

Implement the '&&' function in a shell

Hello, I'm currently implementing the && function in a shell using C. For example, if we input cmd1 && cmd2, then cmd2 executes only when cmd1 exits successfully. I'm thinking about: int main() { int i; char **args; while(1) { printf("yongfeng's shell:~$ "); args =... (5 Replies)
Discussion started by: Yongfeng
5 Replies

9. Shell Programming and Scripting

Trying to implement count_collatz_step function

Can anyone give me a clue why this code doesn't work as expected? The function count_collatz_step() take one parameter which a number that need to calculate collatz until it reaches 1. The func should return steps it takes. # # Count steps of collatz conjecture takes, until the number reach 1.... (8 Replies)
Discussion started by: Bunchhieng
8 Replies

10. Shell Programming and Scripting

Polling file

HI I need some help on this below one Have summuary file coming on daily basis with list of file names and count ,if the summuary file not exist ,pool it for every 5 mins till it arrives .Once arrived remove first and last line from the file and check all the files in respective director all... (12 Replies)
Discussion started by: mohan705
12 Replies
iv_timer(3)						    ivykis programmer's manual						       iv_timer(3)

NAME
iv_timer_register, iv_timer_unregister, iv_timer_registered - deal with ivykis timers SYNOPSIS
#include <iv.h> struct iv_timer { struct timespec expires; void *cookie; void (*handler)(void *); }; void IV_TIMER_INIT(struct iv_timer *timer); void iv_timer_register(struct iv_timer *timer); void iv_timer_unregister(struct iv_timer *timer); int iv_timer_registered(struct iv_timer *timer); DESCRIPTION
The functions iv_timer_register and iv_timer_unregister register, respectively unregister, a timer with the current thread's ivykis event loop. iv_timer_registered on a timer returns true if that timer is currently registered with ivykis. When a timer that is registered becomes 'ready', due to the current system clock value becoming greater than or equal to the timer's ->expires member field, the callback function specified by ->handler is called in the thread that the timer was registered in, with ->cookie as its first and sole argument. When this happens, the timer is transparently unregistered. The application is allowed to change the ->cookie and ->handler members at any time. The application is not allowed to change the ->expires member while the timer is registered. A given struct iv_timer can only be registered in one thread at a time, and a timer can only be unregistered in the thread that it was reg- istered from. There is no limit on the number of timers registered at once. See iv_examples(3) for programming examples. SEE ALSO
ivykis(3), iv_examples(3) ivykis 2010-08-15 iv_timer(3)
All times are GMT -4. The time now is 01:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy