Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Search Forums » Search Results » View Thread |
Messages 1 to 6 of 6 total |
Thread and local variables |
Tue, Sep 18 2018 3:56 PM | Permanent Link |
Ronald | Hi, Just to be absolutely sure... If I do this in a EWB module: procedure TgdbaModule.EWBModuleExecute(Request: TEWBServerRequest); var UserNo :string; begin UserNo:=Request.RequestParams.Values['userno']; end; Then the variable UserNo is unique for each call? The next call does not overwrite it? Thanks, Ronald |
Wed, Sep 19 2018 1:23 AM | Permanent Link |
Michael Dreher | Ronald wrote: // Then the variable UserNo is unique for each call? The next call does not overwrite it? Thread functions and any of the routines they call have their own local variables for different thread invocations. So yes. Michael Dreher |
Wed, Sep 19 2018 3:00 AM | Permanent Link |
Ronald | Michael Dreher wrote: < Thread functions and any of the routines they call have their own local variables for different thread invocations. So yes. > Thanks. Now I have 2 more questions: 1: If I would call a function by reference with that variable, would that still OK? Or can other threads mess this up? Like this: procedure AddSomething(var aUserNo:string); begin aUserNo:=aUserNo+'x'; end; I assume I can do this, because the variable has its own address in memory, local for the calling function. 2. But if aUserNo has not been initialized on beforehand in the calling function, would that be a problem? Does it have an address in memory then? It is only declared in de the calling function, but not yet given a value. Hope you understand what I mean. Ronald |
Wed, Sep 19 2018 6:35 AM | Permanent Link |
Matthew Jones | So long as it is not using a global variable, then it will be good. Be careful though as some functions (like date/time formatting) often use a global buffer to operate. As for assigning to aUserNo if it hasn't been initialized, that's a problem regardless of threads. It probably won't crash, but it probably won't do what you want either. |
Wed, Sep 19 2018 12:41 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Ronald, << Then the variable UserNo is unique for each call? The next call does not overwrite it? >> I'm late getting here, but just to confirm, yes, that is correct. Tim Young Elevate Software www.elevatesoft.com |
Thu, Sep 20 2018 5:31 AM | Permanent Link |
Ronald | Thanks all! Ronald |
This web page was last updated on Thursday, December 5, 2024 at 09:15 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |