Questions tagged [tthread]

92 questions
6
votes
4 answers

What is the proper way to wait for TThread instance to start up

Between time of TThread instance creation and start up, main thread will continue with code execution. If code in main thread depends on thread in question to be fully up and running it has to wait somehow until thread Execute method actually…
Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159
5
votes
1 answer

Using the Delphi XE7 Parallel Library

I have a time consuming routine which I'd like to process in parallel using Delphi XE7's new parallel library. Here is the single threaded version: procedure TTerritoryList.SetUpdating(const Value: boolean); var i, n: Integer; begin if…
Steve Maughan
  • 1,174
  • 3
  • 19
  • 30
5
votes
2 answers

Thread Message Loop Hangs in Delphi

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'…
5
votes
4 answers

Can I raise an exception from within OnTerminate event of a TThread?

I wrote a TThread descendant class that, if an exception is raised, saves exception's Class and Message in two private fields private //... FExceptionClass: ExceptClass; // --> Class of Exception FExceptionMessage: String; //... I thought…
yankee
  • 509
  • 2
  • 9
  • 18
4
votes
1 answer

Using TEvent and MsgWaitForMultipleObjects in blocking main thread

I have found this Remy's interesting code. Delphi : How to create and use Thread locally? Can this be done so I can do multiple threads and wait until they are all finished and then continue with main thread? I tried it like this but no…
davornik
  • 81
  • 6
4
votes
1 answer

What is the purpose of TThread.FinishThreadExecution, and when is it called?

I've been trying to implement a thread that runs in the background and updates a progress bar every second or so and following the example in the top answer to Delphi - timer inside thread generates AV. I notice that the proposed solution has an…
4
votes
2 answers

When do I need synchronize in TThread?

I know that you need synchronize (yourprocedure) to set e.g. a label's text. But what about: Reading a label's text. Toggle/Set the label's enabled property. Call other labels procedures/functions (e.g. onclick event). Is there an easy rule to…
Ben
  • 3,380
  • 2
  • 44
  • 98
4
votes
1 answer

Delphi webbrowser get all links in tthread object

I'm having trouble running my code in a tthread object. Its supposed to go through all the links in twebbrowser and then copy it to a memo if the url contains 'http://www.ebay.com/itm/'. The code works perfectly in in the mainform but doesn't work…
rookie Bounty
  • 127
  • 1
  • 2
  • 7
4
votes
3 answers

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…
migajek
  • 8,524
  • 15
  • 77
  • 116
4
votes
2 answers

TStringList and TThread that does not free all of its memory

Version used: Delphi 7. I'm working on a program that does a simple for loop on a Virtual ListView. The data is stored in the following record: type TList=record Item:Integer; SubItem1:String; SubItem2:String; end; Item is the index. SubItem1…
Pascal Bergeron
  • 761
  • 3
  • 12
  • 27
3
votes
1 answer

Creating MainForm on a TThread

I have a Delphi 2010 application that exports a DLL and has the library header. It creates its MainForm in a TThread, like so: var ActiveThread: TActive; type TActive= class(TThread) protected procedure Execute; override; …
Gege GMF
  • 55
  • 5
3
votes
1 answer

How to capture suddenly destructed TThread

My Environment: Rad Studio XE4 using C++ I am working on a software using TThread. Recently, I am facing a problem in which the TThread is suddenly destructed after several days from the program start. In the TThread, the thread changes displays of…
sevenOfNine
  • 1,509
  • 16
  • 37
3
votes
3 answers

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

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,…
Steve
  • 2,510
  • 4
  • 34
  • 53
3
votes
3 answers

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…
Keyland
  • 33
  • 1
  • 4
3
votes
1 answer

Jpeg save to base64 in TThread

I have a some problem with Delphi. I was write two simple functions for make the screenshot, convert it to jpeg and decode into base64 stream. And its works good if i make it on main stream program. But if i create a TThread class and start this…
Illia Moroz
  • 343
  • 1
  • 2
  • 13