Article View: borland.public.cppbuilder.nativeapi
Article #10477Thread problem
From: ScOe
Date: Sat, 10 Apr 2004 21:41
Date: Sat, 10 Apr 2004 21:41
29 lines
1807 bytes
1807 bytes
When i put InternetReadFile in Thread it does not read anything ... same
thing without thread work fine.
my thread's execute procedure:
char buf[512];
Synchronize (CheckUsage);
while(InternetReadFile(hResource, buf, sizeof (buf), &bytesRead)){
if(!WriteFile(hFile, buf, bytesRead, &BytesWritten, NULL)){
Terminate ();
}
Synchronize (UpdateCaptions);
if (Terminated)
break;
}
i call thread from with:
DownloadThread *pLnLoading = new DownloadThread (true);
pLnLoading->hResource = hResource;
pLnLoading->hFile = hFile;
pLnLoading->Resume ();
what can cause problem ... i've trace it with debugger but i could not find
anything except that on InternetReadFile it breaks ...
hResource is defined as well as hFile (which is not yet used)
One more question. Is it ok to directly write to file or should i use some
kind of memory buffer and than write complete file ?
thanx
Technical Details
Message-ID:
<40786a8e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,a263a901284a81a5,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-10 14:49:12 PST From: "ScOe" <cbinders@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Thread problem Date: Sat, 10 Apr 2004 23:41:01 +0200 Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 195.29.61.54 Message-ID: <40786a8e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1081633422 195.29.61.54 (10 Apr 2004 14:43:42 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail