Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-02

is resourcestring translation thread safe ?

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello,

Let's say I have a multi-threaded cgi (such as brook framework), and I use resourcestring to translate strings.
Does the translation of resourcestring will be based on a thread - that is a copy for each thread, or will it be globally changed ?

Thanks,
Ido

Sven Barth
to ik
ik wrote 6 lines
Hello, Let's say I have a multi-threaded cgi (such as brook framework), and I use resourcestring to translate strings. Does the translation of resourcestring will be based on a thread - that is a copy for each thread, or will it be globally changed ?

It's globally. There is one resourcestring table for each unit and this will be changed through calls to SetResourceStrings ( http://community.freepascal.org/docs-html/rtl/objpas/setresourcestrings.html ).

Regards,
Sven

ik
to Sven Barth
Sven Barth wrote 14 lines
On 21.02.2013 17:55, ik wrote: > > Hello, > > Let's say I have a multi-threaded cgi (such as brook framework), and I > use resourcestring to translate strings. > Does the translation of resourcestring will be based on a thread - > that is a copy for each thread, or will it be globally changed ? It's globally. There is one resourcestring table for each unit and this will be changed through calls to SetResourceStrings ( http://community.freepascal.org/docs-html/rtl/objpas/setresourcestrings.html ).

I know it, but the question is, is it thread safe, so each thread can translate it differently on the same process at run time ?

Show quoted text 7 lines
Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Sven Barth
to ik
ik wrote 18 lines
On Thu, Feb 21, 2013 at 8:06 PM, Sven Barth wrote: > On 21.02.2013 17:55, ik wrote: >> >> Hello, >> >> Let's say I have a multi-threaded cgi (such as brook framework), and I >> use resourcestring to translate strings. >> Does the translation of resourcestring will be based on a thread - >> that is a copy for each thread, or will it be globally changed ? > > > It's globally. There is one resourcestring table for each unit and this will > be changed through calls to SetResourceStrings ( > http://community.freepascal.org/docs-html/rtl/objpas/setresourcestrings.html > ). I know it, but the question is, is it thread safe, so each thread can translate it differently on the same process at run time ?

There is one table for each unit in which each resource string of the unit is located exactly once with one translation. Does this answer your question?

Regards,
Sven

ik
to Sven Barth
Sven Barth wrote 32 lines
On 21.02.2013 19:14, ik wrote: > > On Thu, Feb 21, 2013 at 8:06 PM, Sven Barth > wrote: >> >> On 21.02.2013 17:55, ik wrote: >>> >>> >>> Hello, >>> >>> Let's say I have a multi-threaded cgi (such as brook framework), and I >>> use resourcestring to translate strings. >>> Does the translation of resourcestring will be based on a thread - >>> that is a copy for each thread, or will it be globally changed ? >> >> >> >> It's globally. There is one resourcestring table for each unit and this >> will >> be changed through calls to SetResourceStrings ( >> >> http://community.freepascal.org/docs-html/rtl/objpas/setresourcestrings.html >> ). > > > I know it, but the question is, is it thread safe, so each thread can > translate it differently on the same process at run time ? There is one table for each unit in which each resource string of the unit is located exactly once with one translation. Does this answer your question?

Thanks

Show quoted text 10 lines
Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal