home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2379 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.1 KB

  1. Path: informatik.tu-muenchen.de!fischerj
  2. From: fischerj@informatik.tu-muenchen.de (Juergen "Rally" Fischer)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Passing arguments to a thread
  5. Date: 30 Jan 1996 16:13:20 GMT
  6. Organization: Technische Universitaet Muenchen, Germany
  7. Distribution: world
  8. Message-ID: <4elg30$695@sunsystem5.informatik.tu-muenchen.de>
  9. References: <4ed1eq$nfi@newsy.ifm.liu.se>
  10. NNTP-Posting-Host: hphalle7g.informatik.tu-muenchen.de
  11. Originator: fischerj@hphalle7g.informatik.tu-muenchen.de
  12.  
  13.  
  14. In article <4ed1eq$nfi@newsy.ifm.liu.se>, d93marbl@isy.liu.se (Martin Blom) writes:
  15. |> Lines: 19
  16. |> Message-ID: <4ed1eq$nfi@newsy.ifm.liu.se>
  17. |> NNTP-Posting-Host: mut.isy.liu.se
  18. |> Mime-Version: 1.0
  19. |> Content-Type: text/plain; charset=iso-8859-1
  20. |> Content-Transfer-Encoding: 8bit
  21. |> X-Newsreader: NN version 6.5.0 #26 (NOV)
  22. |> 
  23. |> Is there a (nice) way to pass arguments to a new process?
  24. |> Right now I allocate some memory and copy the following code:
  25. |> Kick:
  26. |>      lea    kick(pc),a1
  27. |>      move.l #0,a0
  28. Why not load a0 from a global var ?
  29. |>      jmp    ThreadStart
  30. Isn't this rather a jmp (a0) ?
  31.  
  32. |> 
  33. |> ... modify the #0 to point to my data structure, flush the cache and
  34. |>  start the process (which does FreeVec(a1)).
  35. |> 
  36. |> Somehow, this does not seem like a nice solution.
  37. |> 
  38. |> The code is located in a shared library.
  39.  
  40.  
  41. I don't know if I understood the problem right.
  42.  
  43. You created a new task and want to pass args to it, with the code
  44. beeing shared-lib code ?
  45.  
  46. Well, I'd use global vars. A library can have global vars, if I
  47. understood right (I'd call intbase->activewindow a var global
  48. for the intuilib).
  49.  
  50. idea:
  51.  
  52. argsema dc.l 0
  53. arg     dc.l 0
  54.  
  55.  
  56. calltask:
  57.  
  58.    forbit() ;mhm just for the case permit() needs a forbid(), don't know ;)
  59. getsema:
  60.    permit()
  61.    delay(1)
  62.  
  63.    forbid()
  64.    tst.l argsema
  65.    bne getsema
  66.  
  67.    move.l #1,argsema
  68.    move.l a0,arg     ;you called "calltask" with args in a0
  69.  
  70.  
  71.    ; do a proper call of createproc
  72.  
  73.    permit() ;well if createproc does not keep in forbid state, I'm in deep shit.
  74.             ;this task will go on in permit state and other task will be put
  75.             ;in a list, right ?
  76.  
  77.    ds.l 0
  78. seglist:
  79.    dc.l 0
  80.    dc.l 16
  81.    dc.l 0
  82. newtaskcode:
  83.    tst.l argsema
  84.    bne newtaskcode
  85.    
  86.    move.l arg,a0 ;Now I imho got the info that was passed to "calltask"
  87.  
  88.    clr.l argsema ;free variable for other tasks that use "calltask".
  89.  
  90.    ....
  91.  
  92.  
  93. Well, can it be done like that ? I bet normally it's done different
  94. on Amiga, but would this work ?
  95.  
  96.  
  97. Or is there a clever way that also would work for multiprocessor systems ;)
  98.  
  99. Another question: are multiple tasks allowed to putpixel() or
  100. blitXXX() into same window / screen (using the same handle!) ?
  101.  
  102. What are the limits when tasking ?
  103.  
  104. |> 
  105. |> --
  106. |>  +--------- Martin 'Leviticus' Blom ----------+    Commodore 128D 
  107. |>  | Linkoping Institute of Technology - Sweden |    Amiga 4000/040
  108. |>  +----------- lcs@lysator.liu.se -------------+
  109. |>                                   http://www.lysator.liu.se/~lcs/
  110. ------------------------------------------------------------------------
  111.    fischerj@Informatik.TU-Muenchen.DE (Juergen "Rally" Fischer)   =:)
  112.  
  113.