home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18378 < prev    next >
Encoding:
Text File  |  1992-12-23  |  2.5 KB  |  54 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!spool.mu.edu!uwm.edu!linac!att!cbnewsk!pegasus!hansen
  3. From: hansen@pegasus.att.com (Tony L. Hansen)
  4. Subject: Re: C++ Coroutine Class?
  5. Organization: AT&T
  6. Date: Thu, 24 Dec 1992 01:34:46 GMT
  7. Message-ID: <1992Dec24.013446.9434@cbnewsk.cb.att.com>
  8. Summary: class process
  9. Keywords: tasking, coroutines
  10. References: <Bz8A08.63C@csn.org> <1992Dec17.145533.6700@msuinfo.cl.msu.edu>
  11. Sender: hansen@cbnewsk.cb.att.com (tony.l.hansen)
  12. Lines: 40
  13.  
  14. From: engelsma@golden.cps.msu.edu (Jonathan Engelsma (Reid))
  15.  
  16. |> 
  17. |>   3) In Tony Hansen's book "The C++ Answer Book" it mentions that the
  18. |>      solution to problem 7.10 (the new and improved tasking system) does
  19. |>      not run on a Sparc. Is this true, or does anyone have a set of diffs
  20. |>      that will allow it to work?
  21.  
  22. < Haven't read that book so I can't comment on this.    What is the new and
  23. < improved tasking system you are referring to?  Is that different than the
  24. < one provided with CC3.0?  
  25.  
  26. Section 7.10 discusses how to implement a library for writing event-driven
  27. simulations. In the process, is shows one implementation (class process)
  28. that attempts to improve on the task library in various ways.
  29.  
  30. For one, it is almost completely portable as it is written without any
  31. assembly language routines. It does assume that you have a single contiguous
  32. stack which can be saved and restored. The reason it doesn't work on some
  33. RISC machines is typically because of a separate register stack; you would
  34. have to dip down into assembly in order to access and restore a register
  35. stack.
  36.  
  37. The model chosen for class process is very similar to the UNIX model of
  38. processes. The coroutine class, which inherits from class process, provides
  39. an implementation for the virtual member function process::main(). The
  40. coroutine is run using process::exec(). The return value from
  41. process::main(), or the value passed to process::exit(), will be the result
  42. from running the coroutine. A coroutine can be stopped using
  43. process::kill(), paused using process::pause(), awaited using
  44. process::wait(), have its priority manipulated using process::getpriority()
  45. and process::setpriority(), and put to sleep using process::sleep().
  46.  
  47. For further information, see the book. (The code is also available via ftp
  48. to research.att.com. Login as "netlib", use your login id as the password,
  49. and cd to c++/answerbook.)
  50.  
  51.                     Tony Hansen
  52.                 hansen@pegasus.att.com, tony@attmail.com
  53.                 att!pegasus!hansen, attmail!tony
  54.