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