Sponsored Content
Top Forums Programming How to implement polling for a function using timer in C? Post 302145361 by porter on Wednesday 14th of November 2007 02:39:02 AM
Old 11-14-2007
Depends what it's supposed to fit in.

If you are writing a program from scratch then there is no problem with

Code:
main()
{
     while (1)
     {
          sleep(30);
          doCheck();
     }
}

If it's an Xt based client application then use one of the timer callback functions.

It all depends what framework it has to work in.
 

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
B::Hooks::OP::Check(3)					User Contributed Perl Documentation				    B::Hooks::OP::Check(3)

NAME
B::Hooks::OP::Check - Wrap OP check callbacks SYNOPSIS
# include "hook_op_check.h" STATIC OP *my_const_check_op (pTHX_ OP *op, void *user_data) { /* ... */ return op; } STATIC hook_op_check_id my_hook_id = 0; void setup () CODE: my_hook_id = hook_op_check (OP_CONST, my_const_check_op, NULL); void teardown () CODE: hook_op_check_remove (OP_CONST, my_hook_id); DESCRIPTION
This module provides a c api for XS modules to hook into the callbacks of "PL_check". ExtUtils::Depends is used to export all functions for other XS modules to use. Include the following in your Makefile.PL: my $pkg = ExtUtils::Depends->new('Your::XSModule', 'B::Hooks::OP::Check'); WriteMakefile( ... # your normal makefile flags $pkg->get_makefile_vars, ); Your XS module can now include "hook_op_check.h". TYPES
typedef OP *(*hook_op_check_cb) (pTHX_ OP *, void *); Type that callbacks need to implement. typedef UV hook_op_check_id Type to identify a callback. FUNCTIONS
hook_op_check_id hook_op_check (opcode type, hook_op_check_cb cb, void *user_data) Register the callback "cb" to be called after the "PL_check" function for opcodes of the given "type". "user_data" will be passed to the callback as the last argument. Returns an id that can be used to remove the callback later on. void *hook_op_check_remove (opcode type, hook_op_check_id id) Remove the callback identified by "id". Returns the userdata the callback had. AUTHOR
Florian Ragwitz <rafl@debian.org> COPYRIGHT AND LICENSE
Copyright (c) 2008 Florian Ragwitz This module is free software. You may distribute this code under the same terms as Perl itself. perl v5.18.2 2011-09-10 B::Hooks::OP::Check(3)
All times are GMT -4. The time now is 12:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy