1. Erin Stuart
  2. PowerBuilder
  3. Friday, 14 April 2023 21:10 PM UTC

Hi all.

Not new to PB but new to multithreading.  I have a process that using Chilkat, sends an xml string to a query service, and then processes the response file.

I now need to give the user the ability to cancel the call.  All of the processing takes place in a nvo.

Upon receiving the response file I then have to error check, decrypt, and process before I can load the datastore.

I am struggling with how and where to make calls.  Any suggestions or an example of something like this would be greatly appreciated.

I've read the articles by J Fauss, they did not help.

PB2021 / Windows11  / Chilkat 9.5.0.86  

Thank you

 

 

John Fauss Accepted Answer Pending Moderation
  1. Saturday, 15 April 2023 17:16 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Erin -

A few questions, if I may:

1. Is the task being performed by the Chilkat utility cancelable?

2. Does it perform any GUI actions (e.g., MessageBox calls)? 

3. Can you elaborate some more on what the Chilkat utility does? Is it performing a database query? A REST API call?

4. Does your NVO perform any GUI actions?

5. Can you describe how you are attempting to cancel the action that is being performed by the Chilkat utility?

6. If your NVO/code runs in the main/GUI thread (and not as a Shared Object in a separate thread), can the process then be canceled? Simply because code is being executed in a separate thread does not automatically make that code cancelable.

Best regards, John

Comment
  1. Erin Stuart
  2. Monday, 17 April 2023 17:55 PM UTC
Hi John.



The goal would be to stop the call before it happens. That's the only way I can see to 'cancel' the call.

I don't see a way of cancelling the Chilkat call no.

Nothing GUI, there are some calls to 'gnv_app' for auditing.

We are using Chilkat as an API to post a soap call to a query service, so REST API.

The NVO does perform some GUI, but after the datastore is loaded. Processing the response file involves decryption and parsing to load the datastore.

The main User object has a 'cancel button', So after the user selects the 'search' button they would have a limited time to hit cancel. Search issues the call to the nvo to create the SOAP and initiate the post xml.

To point 6 no. There is no way for the user to select 'cancel'. All I'm hoping to do really is set a variable that can be checked prior to issuing the post call.

I was directed to investigate multi threading as a solution.
  1. Helpful
  1. John Fauss
  2. Wednesday, 19 April 2023 02:22 AM UTC
Are you using a function call in the NVO to process the cancel request from the main GUI thread, or an event? If an event, triggered or posted? Approximately how much time elapses between creating the shared object NVO and the initiation of the Chilkat code? Given the limited amount of information and answers to earlier questions you've supplied, this does not sound to me like a good candidate for a cancelable task. What kind of GUI interaction is the NVO performing? Is there any way remove all direct GUI interaction by the NVO?
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Saturday, 15 April 2023 02:47 AM UTC
  2. PowerBuilder
  3. # 2

Hi Erin;

   FYI:  http://chrispollach.blogspot.com/2023/04/multi-thread.html

HTH

Regards .. Chris

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 18 April 2023 16:55 PM UTC
Then you need to download the PB 2021 version from the project's "Archive" sub-folder ...

https://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/MutiThread/Archive

The PB release & build number dependency is reflected in the ZIP file's name.

HTH
  1. Helpful
  1. Erin Stuart
  2. Wednesday, 26 April 2023 19:22 PM UTC
Thank you!

  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 26 April 2023 20:12 PM UTC
You are most welcome!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.