Welcome, Guest. Please login or register.

Author Topic: passing arguments to a CreateNewProc process....etc.  (Read 4924 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Dietmar

  • Full Member
  • ***
  • Join Date: Nov 2002
  • Posts: 220
    • Show all replies
    • http://devplex.awardspace.biz
Re: passing arguments to a CreateNewProc process....etc.
« on: August 03, 2005, 10:48:07 AM »
Quote
you could send a kind of startup-message to the messageport

 
It's easier to pass AllocVec()'ed data in task->tc_UserData. NP_UserData should do the trick but I install it manually, with handshaking via signals. Tasks FreeVec()s the data when done with it.
 

Offline Dietmar

  • Full Member
  • ***
  • Join Date: Nov 2002
  • Posts: 220
    • Show all replies
    • http://devplex.awardspace.biz
Re: passing arguments to a CreateNewProc process....etc.
« Reply #1 on: August 03, 2005, 11:52:48 AM »
Quote
This works, but you must be careful to Forbid() before CreateNewProc() and only Permit() after you've poked the tc_UserData, or you will get rather hard to track race condition.


Nope: Just make the first line of the new task Wait(SIG_HANDSHAKE). The function filling in tc_UserData (after creating the task) can take all time it needs. It then raises SIG_HANDSHAKE via Signal(newtask, SIG_HANDSHAKE). For SIG_HANDSHAKE, use an existing standard signal. I use SIGF_SINGLE.
 

Offline Dietmar

  • Full Member
  • ***
  • Join Date: Nov 2002
  • Posts: 220
    • Show all replies
    • http://devplex.awardspace.biz
Re: passing arguments to a CreateNewProc process....etc.
« Reply #2 on: August 04, 2005, 01:12:33 PM »
Quote
This is hacking and might not work in future releases of the AmigaOS


Maybe :) However, using a task's userdata field is not hacking, using signals is not hacking and passing memory blocks between tasks is not hacking (unless the Amiga API gets incompatible with itself and makes demands such as "owner must free memory"). SIGF_SINGLE signaling was apparently documented on a developer CD. I suppose I picked up its use for task handshaking via Olaf Barthel's Term source code. It had a funny comment: "Task termination and handshake signal. Note: don't try this at home kids, we are all trained professionals here!".