home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / aplusplus-1.01-src.lha / GNU / src / amiga / APlusPlus-1.01 / amiproc / test.c < prev    next >
C/C++ Source or Header  |  1994-01-14  |  844b  |  33 lines

  1. #include "amiproc.h"
  2.  
  3. #include <stdio.h>
  4.  
  5. /* Declare some __near external data.  This is reallocated for  */
  6. /* each new subprocess, so all processes have their own private */
  7. /* copy.  When the copy is first made, it will have the value   */
  8. /* it's being set to here, even if the parent has changed it.   */
  9. char *ext = "This is the original value of ext";
  10.  
  11. int subprocess(void *arg)
  12. {
  13.    printf("%s: ext = \"%s\"\n\n", arg, ext);
  14.    return 0;
  15. }
  16.  
  17. void main(void)
  18. {
  19.    struct AmiProcMsg *first, *second;
  20.    
  21.    first = AmiProc_Start(subprocess, "First subprocess");
  22.  
  23.    subprocess("Original process, before resetting externs");
  24.  
  25.    ext = "This is the new value of ext";
  26.    second = AmiProc_Start(subprocess, "Second subprocess");
  27.  
  28.    subprocess("Original process, after resetting externs");
  29.  
  30.    AmiProc_Wait(first);
  31.    AmiProc_Wait(second);
  32. }
  33.