473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

is this an signal handler or a alarm ?

Hi

I'm not sure if this is correct ...place to post but here goes

This is what i'm trying to do, I want to write a signal / alarm handler
( I don't know which hence the posting here, as once I know the proper
name /useage then I'll use google to try and find out more
information )....
Thus any tips or pointers would be helpful (and I'm using a UNIX variant as
OS)

Many Thanks
David

the (?) means I'm not sure if I need the variable or not...

xxxxxxx( &MyTimeFunction, (?)(void *)SleepCounter );

do_some_other_work(......)
..
..
..
/* Check to see if the sleep counter has been set (ie it has
waited a specific time or timeout period
*/
xxxxxxx( SleepCounter );

void * MyTimeFunction( void * arg ){

int MySleepCounter = (int) arg;
for ( i = 0; i < SOME_SYSTEM_COUNTER; i++ ){}

/* Not sure on this bit also but want to set a value of 1
to denote the sleep time has been set
*/
SleepCounter = 1;
}

Nov 14 '05 #1
3 2650
LeTubs <dl*****@yahoonospam.co.uk> spoke thus:
I'm not sure if this is correct ...place to post but here goes


(It isn't. Now you know.)

Your post is off-topic for comp.lang.c. Please visit

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

for posting guidelines and frequently asked questions. Thank you.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #2
LeTubs wrote:
Hi


IMHO, Most appropriate to comp.unix.programmer . Setting followup-to
appropriately.

HTH
Nov 14 '05 #3
LeTubs wrote:
I'm not sure if this is correct ...place to post but here goes

This is what I'm trying to do, I want to write a signal/alarm handler
(I don't know which hence the posting here,
as once I know the proper name/useage
then I'll use google to try and find out more information )....
Thus any tips or pointers would be helpful
(and I'm using a UNIX variant as OS)


SIGNAL(2) Linux Programmer’s Manual SIGNAL(2)

NAME
signal - ANSI C signal handling

SYNOPSIS
#include <signal.h>

typedef void (*sighandler_t)(int);

sighandler_t signal(int signum, sighandler_t handler);

DESCRIPTION
The signal() system call installs a new signal handler
for the signal with number signum.
The signal handler is set to sighandler which may be
a user specified function, or either SIG_IGN or SIG_DFL.

Upon arrival of a signal with number signum,
the following happens.
If the corresponding handler is set to SIG_IGN,
then the signal is ignored. If the handler is set to SIG_DFL,
then the default action associated to the signal
(see signal(7)) occurs. Finally,
if the handler is set to a function sighandler,
then first either the handler is reset to SIG_DFL
or an implementation-dependent blocking of the signal
is performed and next sighandler is called with argument signum.

Using a signal handler function for a signal
is called "catching the signal".
The signals SIGKILL and SIGSTOP cannot be caught or ignored.

RETURN VALUE
The signal() function returns
the previous value of the signal handler, or SIG_ERR on error.

Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Elf M. Sternberg | last post by:
I'm having a devil of a time with signal handling under BSD 4.4 with Python and I was hoping that this might ring a bell with someone. Using the Webware Application Server (a multi-threaded Python...
5
by: Klaus Neuner | last post by:
Hello, consider the following two programs: # (1) import sys, signal def alarm_handler(signum, frame): raise
0
by: rh0dium | last post by:
Hi all, I don't understand the signal module. I guess I understand what it does in principle but I can't figure out how to use it to timeout an external rsh command after a 5 seconds. Does...
3
by: rh0dium | last post by:
Hi all, Another newbie question. So you can't use signals on threads but you can use select. The reason I want to do this in the first place it I need a timeout. Fundamentally I want to run a...
4
by: Ollie Cook | last post by:
Hi, I am having some difficulty with read(2) and interrupting signals. I expect I am misunderstanding how the two work together, so would appreciate some guidance. I am trying to 'time out' a...
11
by: Jackie | last post by:
Hi everyone, I'd like to know when and how signals are used (e.g. SIGFPE, SIGABRT, SIGTERM, SIGSEGV, SIGINT)? Thank you so much.
3
by: norm4h8 | last post by:
Hi! I have a question about how to create a process in such a way that it would terminate itself if its wated for input for too long. Here is the story. I have 2 different files, say R.c and...
7
by: Adrian Casey | last post by:
I have a multi-threaded python application which uses pexpect to connect to multiple systems concurrently. Each thread within my application is a connection to a remote system. The problem is...
2
by: responsible | last post by:
Hi, I am trying to convert a small piece of source code that was initially written for Linux to build under Windows. My main problem though is in two lines... 1. signal(SIGALRM,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.