1. Roland Smith
  2. PowerBuilder
  3. Friday, 25 June 2021 03:10 AM UTC

I'm making a simple app that uses Winsock to receive messages. It then uses shared objects to process the data. I am giving each request a different instance name in case a second call comes in while the first one.

If I call the shared directory function, it lists all of them. Apparently they don't automatically go away. I added a call to shared unregister immediate after the posted function call. They seem to go away immediately even though the background thread is not finished. If I exit the app while one is running, it waits.

Is there a built in method to tell if a sharedobject instance is currently busy?

Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Tuesday, 29 June 2021 06:53 AM UTC
  2. PowerBuilder
  3. # 1

Hi Roland,

afaik the only way to know if a shared object is currently busy is to keep track of a callback object for each shared object instance that gets notified with an event call once the processing is done. Before posting the function call for your shared object, have the caller use a function to set a reference to the callback object as an instance variable on the shared object. Once processing is done, have the shared object call an event on the callback to let it know it's all done.

You can wrap all this into a thread handler object and let that keep track of everything and unregister the shared object instances once they're done.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 25 June 2021 16:16 PM UTC
  2. PowerBuilder
  3. # 2

Depending on what you do ...

I'm using a shared object to retrieve a very slow dw. In the retrieveEnd I set "ib_retrieving_totals = false" to indicate when the process has finished.

Maybe you can do something similar?

regards.

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 25 June 2021 04:05 AM UTC
  2. PowerBuilder
  3. # 3

Hi, Roland -

I'm still getting up to speed using SharedObjects, but I do not believe there is any native (PowerScript) way to do what you're asking. I've just started work on a "thread manager" object that might accomplish this, but it's more concept than code at this point. It's something I'm working on in my spare time, so it may be some time before I have anything I could share with you.

If you decide to create something similar and it's something you can share, I'd be very interested in seeing what you come up with.

John

Comment
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.