Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: Fake seglist in C...  (Read 3174 times)

0 Members and 1 Guest are viewing this topic.

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #15 on: March 07, 2013, 09:45:21 AM »
*BUMP*

Hoping Karlos, Piru or Thomas see this. :)
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
  • Total likes: 0
    • http://www.troubled-mind.com
Re: Fake seglist in C...
« Reply #16 on: March 07, 2013, 10:29:34 AM »
Quote from: nyteschayde;728478
*BUMP*

Hoping Karlos, Piru or Thomas see this. :)
Piru chooses not to frequent our shores any more :(

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #17 on: March 07, 2013, 10:54:29 AM »
Quote from: bloodline;728481
Piru chooses not to frequent our shores any more :(


That's disheartening to hear. Guess I missed why. Do you know the answer to the question?
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
  • Total likes: 0
    • http://www.troubled-mind.com
Re: Fake seglist in C...
« Reply #18 on: March 07, 2013, 11:16:04 AM »
Quote from: nyteschayde;728483
That's disheartening to hear. Guess I missed why. Do you know the answer to the question?
I can't see clearly what you are trying to achieve, from your question it looks like you are trying to pass arguments/data to the newly started task...

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #19 on: March 07, 2013, 08:25:53 PM »
That is correct. If I want to pass parameters to the function that executes inside a Process created by CreateProc or CreateNewProcTags, how would I do that without referencing global variables?

Is a MsgPort the best way? If so, how would I do that?
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline Thomas

Re: Fake seglist in C...
« Reply #20 on: March 07, 2013, 09:18:21 PM »
The process stucture contains a message port (pr_MsgPort) which can be used for sending an initial message. Check how the startup code for Workbench programs receives the WBStartup message, that's just the same.

But be warned: this port can be used only in the initialisation phase of your new process. Once you want to use DOS functions, you must leave this port alone because DOS uses it for its communication.

I could make an example tomorrow if I find some spare time.

Offline Joloo

Re: Fake seglist in C...
« Reply #21 on: March 07, 2013, 09:37:43 PM »
Quote from: nyteschayde;728526
Is a MsgPort the best way? If so, how would I do that?


Maybe this old example helps you out. If not, wait for Thomas code snippet.
 

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #22 on: March 08, 2013, 12:45:07 AM »
Thanks Thomas. An example would be really helpful given I am still not entirely confident using MsgPorts. Also it seems that the process kicks off right away so how do you get it to wait for the parameters via the MsgPort?

It's amazing that you guys are still knowledgeable with this stuff. I just wish there was proper documentation around. I got my first Amiga in 89 but my programming skills back then weren't anything to write home about (I was like 12 years old). Now that I program for a living professionally I wanted to tinker with some C code on the Amiga and do some fun stuff. Turns out even with the Dev CD 2.1 and related online docs things aren't always clear.

EDIT: If I had to guess it would be some code that Waited for a message at the beginning of the function that gets called by the Process. That being said, how do you reference that MsgPort in order to wait for data? All seems very confusing. If there was like a GetCurrentMsgPort() or equivalent I could see it working. On that note, also, can you use FindTask(NULL) to get a Task struct or are Procs and Tasks just that fundamentally different?
« Last Edit: March 08, 2013, 12:47:06 AM by nyteschayde »
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #23 on: March 08, 2013, 03:29:40 AM »
Quote from: Joloo;728532
Maybe this old example helps you out. If not, wait for Thomas code snippet.


Thanks to you too Joloo. I'll look at what you sent as well.
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #24 on: March 08, 2013, 04:41:38 AM »
Wow! I just found out that CubicIDE is now selling for like $30 USD. I can't believe it. When I first purchased it, it was ludicrously expensive. I may even buy another copy just to support the product!
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #25 on: March 09, 2013, 06:01:47 AM »
Thomas did you get a chance to write a sample? Also would you like me to take this offline given your email address is posted?
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline psxphill

Re: Fake seglist in C...
« Reply #26 on: March 09, 2013, 10:28:58 AM »
Quote from: Thomas;728529
I could make an example tomorrow if I find some spare time.

I might have something from years ago that I can dig out as well.
 

Offline Thomas

Re: Fake seglist in C...
« Reply #27 on: March 09, 2013, 01:29:43 PM »
Quote from: nyteschayde;728626
Thomas did you get a chance to write a sample?


I wish you had more patience ;-)

Here are two examples, a third has yet to come:

http://thomas-rapp.homepage.t-online.de/examples/multi1.c
http://thomas-rapp.homepage.t-online.de/examples/multi2.c

The first is a simple one-shot which does its job in the background without any further communication and only replies when it is finished. The protocol used is very similar to how Workbench runs programs, sends arguments to them and waits until they are finished.

The second one is similar but it sends progress reports to the main task.

The third will be more complex. It should be a kind of server which receives commands and responds to them and stays up until it receives the stop command.

These three examples should cover most cases where you'd use multitasking in an application program.



Quote
Also would you like me to take this offline given your email address is posted?


As you can see from the first page of this thread, I am not all knowing. So it's better to stay here and give others the opportunity to correct me.

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 638
  • Total likes: 2
    • http://www.nyteshade.com
Re: Fake seglist in C...
« Reply #28 on: March 09, 2013, 07:48:27 PM »
I apologize for rushing you. I just excited and driven when I am consumed with a programming task sometimes. Most people just tell me to wait patiently but I agree that I shouldn't have to make you ask. :-\ I am very grateful for your time however. Now I can't wait to get home to my computer. I look forward to your third example as well. Again, thanks.
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline Thomas

Re: Fake seglist in C...
« Reply #29 on: March 10, 2013, 02:16:51 PM »