|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread|
|Messages 1 to 5 of 5 total|
|Mon, Jul 4 2016 6:33 AM||Permanent Link|
I want to start using the Elevate Web Builder Modules. In the manual you warn about thread-safe programming in these modules. I have read about thread safe programming and I understand that I shoud use threads. In your demo application "datasetmodule" I do not see any use of threads. Can you give me a general rule of thumb advice on when to use threads in a module?
|Mon, Jul 4 2016 3:50 PM||Permanent Link|
<In your demo application "datasetmodule" I do not see any use of threads>
Because the thread is managed (created/destroyed/pooled) within the EWB http server.
TExampleDataSetModule is run within a context of this thread. So your code must be thread safe when using shared objects like database connections etc.
<Can you give me a general rule of thumb advice on when to use threads in a module? >
Unless you are going to start an asynchronous job etc. you don't need to create any additional threads in a module.
|Tue, Jul 5 2016 7:35 AM||Permanent Link|
Tim Young [Elevate Software]
Elevate Software, Inc.
Everything that Emin said is 100% correct.
|Thu, Jul 7 2016 10:03 AM||Permanent Link|
Thanks Emin and Tim,
But I still should not use global variables and I should take extra care when reading and writing to a .txt file on disk for example, I presume?
|Thu, Jul 7 2016 10:09 AM||Permanent Link|
On 7/7/2016 10:03 AM, Ronald wrote:
> But I still should not use global variables and I should take extra care when reading and writing to a .txt file on disk for example, I presume?
In terms of accessing database (EDB/DBISAM) then you need to follow
thread safe instructions for each.
In terms of things like simple global variables (not EDB/DBISAM objects
like sessions, tables, queries) if they are set one (say on startup) and
then various threads simply read them then you're ok.
If however the global variables are read and updated by one or more
thread during runtime then you definitely need to use some sort of
locking/syncronization method for access.
Similar rules apply to file reading/writing
This web page was last updated on
Saturday, June 3, 2023 at 10:17 AM
© 2023 Elevate Software, Inc. All Rights Reserved
Questions or comments ? E-mail us at firstname.lastname@example.org