Questions tagged [tthread]
92 questions
0
votes
1 answer
Passing parameters to TThread::Queue using lambda in C++ Builder
I want to do something like this:
void TForm2::SetMsg(UnicodeString fMsg)
{
// If thread is not main Queue...
if (GetCurrentThreadId() != System::MainThreadID)
{
TThread::Queue( nullptr, [&]() -> void { Form2->SetMsg(fMsg); } );
return;
…

Coder12345
- 3,431
- 3
- 33
- 73
0
votes
2 answers
TThread Doesn't Do It's Job Unless there is a MessageBox in the Middle !
i created a class of TThread to do some socket operations, the thing is, the code doesnt work unless i add MessageBox to it, sockets wont work unless i put a MessageBox call before it
Sleep(2000); //Waiting for the Socket to Come to the Array
//…

killercode
- 1,666
- 5
- 29
- 42
0
votes
2 answers
How to pass or make public variables or fields accessible to Tthread?
I am writing and building my software for Mono using Delphi Prism. So, I decided that my serial communication will be handled by a thread. Since global variables strictly are not allowed unless you enable the global variable option for the project,…

ThN
- 3,235
- 3
- 57
- 115
0
votes
0 answers
TThread self terminate, do I need OnTerminate with a Destructor?
I have a thread class to do some work then post a message to the main app thread and self terminate. What's the correct way to do this, do I need an OnTerminate procedure or is the Destructor enough?
(The threads List is a bit irrelevant to the…

hikari
- 3,393
- 1
- 33
- 72
0
votes
0 answers
TThread one instance at a Time
I need a single background thread for my application . If triggered it will simply do some queries against a SQL Database and update another Table . For the sake of simplicity I built myself a Test project to test out my idea . And I came up with…

user1937012
- 1,031
- 11
- 20
0
votes
0 answers
Should I use critical section or syncronize/queue to modify class data members?
Let's say TForm1 class (default main window) contains data member int x;. If I create additional threads from TThread descendant should I use critical section object or Synchronize/Queue methods to modify value of x inside thread's Execute method?…

Tracer
- 2,544
- 2
- 23
- 58
0
votes
1 answer
delphi xe2 proper disposal of a pointer created from a thread which pointer is being sent to main thread
I would like to ask few questions, let me explain things to you first and you can see the questions below this post. I created a multi threading app which reads and update data from a database. The threads communicates with the main thread using…

Francis Carillo
- 77
- 1
- 9
0
votes
0 answers
Open more ClientDataSets at same time with TTHread
I'm a beginner with threads in delphi. I wrote this code and it works very well.
It starts with opening ClientDataSet1 until it is completed and then opening ClientDataSet2 and so on.
My question is: how to start opening them at the same…

Ferrero
- 21
- 2
0
votes
2 answers
How to use TThread the right way
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…

serhiyiv
- 183
- 1
- 2
- 10
0
votes
1 answer
Keep the number of running thread
in my main application C++ builder, I create thread (Object TThread) to process file when i have a file in the list.
At same times, I need to keep the number of running thread.
i don't see how to do that? Any suggestion?
Thank you.
user4054093
0
votes
3 answers
Set/Change TThread.FreeOnTerminate while on TThread.OnTerminate
I've been trying to to set the FreeOnTerminate property in the OnTerminate procedure but it seems like it's either too late to set it or it's completely ignoring the write procedure.
How can I set/change the FreeOnTerminate property in the…

Ben
- 3,380
- 2
- 44
- 98
0
votes
1 answer
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…
user195488
0
votes
2 answers
what to substitute for TThread
I have source code for USB communication ("USBThread class") written in Borland C++ and uses Visual Component Library("vcl.h").
Now my task is to port that to Visual C++, because we did not buy Borland C++.
But this "USBThread class" has…

user1352716
- 1
- 1
-1
votes
1 answer
Delphi Thread doesn't run
I'm trying to search for all files in all subfolders so it takes long time and application stop responding, so I used Thread (it's first time work with Threads) I read about it and I found this way to create and execute threads, but nothing happen…

Delphi Lover
- 85
- 1
- 11
-1
votes
2 answers
Recreating a TThread Inside a TThread dervied class
I created a new class derived from TThread class, and on the constructor i call "inherited Create(True);", and then call "Resume()" since i have override the Execute() call, now i wanna recall the Execute() (Run the Thread Again) without destroying…

Zakri Vorschted
- 11
- 2
- 5