Hello:
Is a string[30] declaration under Linux thread safe?
I am not worried about atomicity, just that the memory for a string[30]
if thread safe.
For UTF8String, it is not.
I have 2 threads which are comparing/changing memory and I do not
want criticalsections wrapping the memory accesses for speed reasons.
Type
Class TTest(TObject)
public
nflag : integer ;
sflag : string[30]
end;
Gui Thread
gtest := TTest.Create ;
Thread #1 - Constantly changing values
while true do
begin
gtest.nflag := Random($FFFFFFFF) ;
gtest.sflag := inttostr(gtest.nflag) ;
end;
Thread #2 - Constantly Comparing values
While true do
begin
if gtest.nflag = 777888 then
begin
break ;
end;
//Test string matching instead of integer matching
if gtest.sflag = '123456' then
begin
LaunchSpaceShuttle(gtest) ;
end;
end;
Thanks for any replies,
marco
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal