home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!wupost!darwin.sura.net!mips!nec-gw!netkeeper!news
- From: pradeep@tdd.sj.nec.com (Pradeep Badri)
- Subject: Task Library Interrupt Handler.
- Message-ID: <1992Aug17.231252.3729@sj.nec.com>
- Keywords: Task Library
- Sender: news@sj.nec.com
- Nntp-Posting-Host: necsun
- Organization: NEC-AM TDD, San Jose, California
- Distribution: usa
- Date: Mon, 17 Aug 1992 23:12:52 GMT
- Lines: 49
-
- Hello,
-
- I am using AT&T C++ 2.1 Task Library in building my software.
- I have already developed a major part of the s/w. Now, I needed
- to implement a timer which I can use for timeout operation. and would
- simulate timeout in Real Time. I started off by using the
- timer class provided in the task library itself. But I found out that
- the system clock advanced in an arithmetic way i.e. if a task calls
- delay(50), and assuming all other tasks are blocked, the delay call
- returns immediately and system clock advances by 50. There is no
- hook provided so that we can make timer class run on real time.
-
- So I decided to use the interrupt_alerter task using alarm calls which
- generates SIGALRM signal. I have written my own timer object but I have
- some basic problem. To explain my problem in a nutshell :
-
- -----------------------------------------------------
- #include "task.h"
-
- main()
- {
- Interrupt_handler hdlr(SIGALRM) ;
-
- thistask->wait(&hdlr) ;
-
- }
-
- // I have not not used alarm() system call. So a SIGALRM
- // would never happen. Hence wait on hdlr would block main
- // task forever.
- -----------------------------------------------------
-
-
- So my problem is: If I compile and trace the program execution, I find
- that the wait4(......) system call is made once main gets blocked .
- CAN ANYONE LET ME KNOW WHY THIS wait4() IS CALLED.
- In the above case, since there is no child spawned, so the
- wait4 returns -1 and everything goes fine.
- But If I do fork and exec before main gets blocked , wait4()
- suspends the entire process till the child exits.
-
- I HOPE I EXPLAINED MY PROBLEM. IT MAY BECOME CLEARER IF YOU COMPILE
- ABOVE PRGM AND TRACE IT. I WOULD BE VERY HAPPY IF SOMEONE HELPS ME.
-
- PLEASE REPLY TO MY EMAIL ADDR.
- EMAIL:: pradeep@tdd.sj.nec.com
- Phone:: 408-433-2904.(Pl. leave your number in my voice mail).
-
- Thanks a lot. (Pradeep Badri).
-