🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1825

Thread safety

#1825
From: Colin B Maharaj
Date: Tue, 12 Jun 2007 10:29
27 lines
1781 bytes
Hi all, I am trying to write some multi-threading Indy(9.0.50) code
and while I have learn't a lot so far, I think I am getting into trouble
by using unsafe thread code in my app.

Here is where I have reached so far.

1. First I thought I could not use ReadLn() WriteLn() in my code
because I thought AnsiString were not thread safe. Is this still the case?

2. I definitely learn't that sprintf is unsafe and try to create
my own simple char array string function with local storage.

3. Naturally I am not updating or accessing any visual controls from
my code.

4. I am using mutex/WaitForSingleObject when a thread needs
to update a single log file.

Thing is now Code Guard is crashing with an access violation.

Is there anything else I need to know w.r.t. thread safety
that will help my design. e.g. what further functions / code 
construction to avoid?

Thanks!

Colin
Technical Details
Message-ID: <466e7571$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7fa2ebca6213823d,start
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 12 Jun 2007 06:29:05 -0400
From: Colin B Maharaj <noreply@myhost.com>
User-Agent: Thunderbird 1.5.0.12 (Windows/20070509)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Thread safety
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 000748-3, 06/11/2007), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 190.58.14.113
Message-ID: <466e7571$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1181644145 190.58.14.113 (12 Jun 2007 03:29:05 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail