home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12452 < prev    next >
Encoding:
Text File  |  1992-08-17  |  2.4 KB  |  63 lines

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