tthread

Delphi TThread.CurrentThread and EAccessViolation - Is This a Bug or My Incompetence..?

In Delphi 2009 I'm finding that any time I use TThread.CurrentThread in an application, I'll get an error message like the following when the application closes: Exception EAccessViolation in module ntdll.dll at 0003DBBA. Access violation at address 7799DBBA in module 'ntdll.dll'. Write of address 00000014. Unless it's just my machin...

How do I port code for Borland C++ builder to Linux?

I have source code for a Windows DLL that is written in C++ and uses Visual Component Library. Now my task is to port that to Linux, but I don't have source code for the VCL itself, or any kind of documentation (and I have never worked with Borland C++; in my Windows days I used MFC). This should not be all that hard, since my DLL does ...

A proper way of destroying a TThread object

This question may seem trivial, but I hope you won't ignore it. Before destroying a TThread object it is usually necessary to wait until the thread that called the TThread.Execute() method finishes, for only then can we be sure that, for instance, the objects destroyed inside the class's destructor are no longer accessed. Therefore it is...

delphi - terminate all the threads (TThread) on closing application

My application is a tcp/ip server, with main thread created only once & listening all the time. When new client connects, the main thread creates the new thread of TClientThread type. There is however no list of running Client threads, as that would make my app a bit complicated... is there any way to execute "terminate" method on all th...

C++ Builder - Spawn TThreads On the Fly

I'm looking for the ability to spawn a thread or function so that it returns immediately to the calling line and continue on with the program but continues with the thread work. For instance, if you call Form.ShowDialog(), it will create a modeless form that has its own UI thread. Is there a way to do this (no form) without having to ...

With what delphi Code should I replace my calls to deprecated TThread method Suspend?

It has been asked before, but without a full answer. This is to do with the so called famous "‘Fatal threading model!’". I need to replace this call to TThread.Suspend with something safe, that returns when terminated or resumed: procedure TMyThread.Execute; begin while (not Terminated) do begin if PendingOffline then begin ...

Thread Message Loop Hangs in Delphi

Hello all. I have a simple Delphi program that I'm working on, in which I am attempting to use threading to separate the functionality of the program from its GUI, and to keep the GUI responsive during more lengthy tasks, etc. Basically, I have a 'controller' TThread, and a 'view' TForm. The view knows the controller's handle, which i...

Problem with running WebService in separate thread in Delphi

I have never asked questions in any community as I always solved problems by myself or could find them online. But with this one I came to dead end and need Help! To make it very clear – I converted a simple app, found elsewhere to make it use a Tthread object. The idea is simple – the app checks online using webservice, through THTTPRIO...

Some help with TThread (Terminate, FreeOnTerminate and other adventures in the realm of threading)

Hello all, I'm trying the achieve the following (using Delphi7): After logging in to my program, the user gains control, but in the background a separate thread downloads a file from the Internet to check if the current license key is blacklisted. If it is, the user receives a prompt and the program terminates. So I've created a separa...

Free a TThread either automatically or manually

Hello all! I have a main thread and a separate thread in my program. If the separate thread finishes before the main thread, it should free itself automatically. If the main thread finishes first, it should free the separate thread. I know about FreeOnTerminate, and I've read that you have to be careful using it. My question is, is th...

How to use TThread the right way.

Hi. Could you help me please. I'm writing a component (something like TListView), In my component I perform 3 procedures one by one: procedure findFiles(Path:String); // using FindFirst, FindNext procedure ArrangeItems; // assigns Item Position procedure SetIcons; // Loads Images, resizes, adds to ImageList I can not understand ho...