• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

locking instantiated components

Participant ,
Jun 14, 2007 Jun 14, 2007

Copy link to clipboard

Copied

are methods single threaded?

IE, when thread A calls method C, and thread B calls method C, of object O, do each have their own method? Or are they sharing the method and the same local variables? So do then the local variables need locking, or do/should I lock the component call, or just the method by name?

I'm a bit confused on this.
TOPICS
Advanced techniques

Views

242

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2007 Jun 14, 2007

Copy link to clipboard

Copied

Local variables don't need locking. As long as you use the var keyword in your functions, you'll be fine.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 15, 2007 Jun 15, 2007

Copy link to clipboard

Copied

If you "var" your function variables then you don't need to lock them. They will only exist inside the function and each thread that executes that function will basically have its own copy of the var'd variables. So they won't conflict with each other.

<cffunction name="YourFunction">
<cfset var YourVariable = "999" />
.....
</cffunction>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 16, 2007 Jun 16, 2007

Copy link to clipboard

Copied

LATEST
thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation