NetTalk Central

Author Topic: STARTing a procedure  (Read 5268 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
STARTing a procedure
« on: November 17, 2010, 11:17:17 PM »
Hi
Is there a safe way to START a procedure on its own thread from a netweb procedure?
I've tried a couple of ways but it always seemed to crash the server.
So then I put a button on the web server window and started a thread from there - and THAT crashed it immediately.
thanks
chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: STARTing a procedure
« Reply #1 on: November 18, 2010, 02:43:30 AM »
Starting a thread can be done from anywhere, using the START command.
From your description it sounds to me like perhaps your general Starting technique is faulty.

Perhaps post more information about the command you're using to Start a thread.

Cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: STARTing a procedure
« Reply #2 on: November 18, 2010, 03:36:55 AM »
The most likely reason for a GPF when manually starting a thread, is that you're not setting some threaded global variable correctly.

For example;
In my app I set the Filename variables, and glo:owner connection variables in the WebHandler, ProcessLink method, before the parent call. So anytime the Server starts a new thread, all the threaded global strings are ready to be used.

If however I START a thread manually, then I need to remember to set these variables, or that thread will crash when it tries to access a file.

Cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: STARTing a procedure
« Reply #3 on: November 18, 2010, 06:47:55 AM »
I'm starting a report to generate a PDF that is used later. The report doesn't have to know about the webserver all it needs is the order number, which I pass as a string parameter.
START(Reporter,20000,p_web.gsv('ord:ordid'))
the prototype is (String p_ordid)
the report thiswindow init has currentId = p_OrdId to set the string to a long which is used in the range for the report.
The button I put on the webserver window had the parameters (Reporter,20000,'23')
I also have SV report to PDF and Extend progress window to keep the report progress from popping up on the server

If that all sounds correct, then I will dig a little deeper into my code. Maybe there is something in where I get the blob for the mailing label...

I thought that there was a checkbox somewhere that I wasn't getting.

chris
Real programmers use copy con newapp.exe

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: STARTing a procedure
« Reply #4 on: November 18, 2010, 08:05:50 PM »
Hi Chris,

I do a similar thing with reports and some other process's that can run on a background Thread.

Try the following

L:OrdID = p_web.gsv('ord:ordid')

START(Reporter,20000,L:OrdID)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: STARTing a procedure
« Reply #5 on: November 21, 2010, 07:37:28 AM »
Kevin,

That is just what I am doing to call the procedure so I think it is something else inside the report.

chris

Real programmers use copy con newapp.exe

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: STARTing a procedure
« Reply #6 on: November 21, 2010, 01:38:59 PM »
What happens if you just call the procedure rather than running on a new thread?


ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: STARTing a procedure
« Reply #7 on: November 21, 2010, 02:36:28 PM »
essentially, the eweb page takes too long to refresh since it needs to wait for the report to finish.
What I have do is to make the form go to a page that displays the PDF. The link in that page calls the report. The user can jump out early if they don't want to wait for the PDF to load and that doesn't affect the report output.

There is something strange going on there and I will need to address it before too long, but not today. A fire to be put out at a later time.

chris
Real programmers use copy con newapp.exe

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: STARTing a procedure
« Reply #8 on: November 21, 2010, 05:49:05 PM »
Maybe you should experiment with Start and calling the report in the PDF example app to narrow down the prob.