1. Roland Smith
  2. PowerBuilder
  3. Tuesday, 11 April 2023 14:01 PM UTC

I have used SharedObject functions to do multi-threading so I am familiar with the concepts. My app doesn't have a user interface. The main thread runs in the background listening for processing requests via Winsock.

The first question is about re-use. If a background thread notifies the controller in the main thread that it is done, would it be worthwhile to somehow track it as 'idle' and reuse it for the next request? If I just unregister the thread, there is no tracking to complicate things.

The second question has to do with the library manager. When a background thread instantiates an object locally, the PBD it resides in gets loaded into memory. If the main thread or another background thread later instantiates that same object, does it use the in memory copy or does it have to load the file from disk again?

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 11 April 2023 18:08 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi  Roland;

  A1: Technically speaking, reusing the thread components would save you small amount of instantiation costs but at today's processor speeds, I am not sure if that would save you a lot (or even be that measurable). Just my $0.02.

  A2: The App itself (main thread) manages the "Class Pool", thus for any sub-thread, the PB Class Loader always checks the main threads Class Pool before searching the PBL/PBD/DLL's in the library list. So once in the Class Pool, further instantiations of sub-threads would be really fast.

HTH

Regards ...C hris

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 11 April 2023 19:48 PM UTC
Hi Roland;

The last DPB demo app that I have found (thus far) seems to be written in PB 6.0.

Regards ... Chris
  1. Helpful
  1. Roland Smith
  2. Tuesday, 11 April 2023 20:03 PM UTC
Do you have a link to download it?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 11 April 2023 20:43 PM UTC
No but, I'll put it on my Google drive and then send you the down link sometime this evening.
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.