Board index » cppbuilder » Thread-Problem

Thread-Problem


2004-03-02 04:22:30 PM
cppbuilder99
Hi,
I'm writing an Application with a Thread and my problem is, it doesn't start
Okay, some code-snippets:
I try to Start it like this:
TThread_p->Resume();
and in the Execute-Function it looks like this:
while (!Terminated)
{
but if i set a Breakpoint in the while-loop, the de{*word*81} only stops there
when i re-compile the app.
why?
thanx very much!
 
 

Re:Thread-Problem

Ron Eggler wrote:
Quote
Hi,

I'm writing an Application with a Thread and my problem is, it doesn't start

Okay, some code-snippets:
I try to Start it like this:
TThread_p->Resume();

and in the Execute-Function it looks like this:
while (!Terminated)

{

but if i set a Breakpoint in the while-loop, the de{*word*81} only stops there
when i re-compile the app.
Can you explain more detailed whats happening? As far as I know you
first have to stop the de{*word*81} and application before you can recompile.
As Liz allready pointed out including actual code which can be compiled
will help in getting usefull answers.
Some things you could check:
Did you check Resume is actually called?
Is the breakpoint enabled? Builder might disable it because it cannot
break at the line you specified.
Eelke
 

Re:Thread-Problem

Okay, know i solved this and my Problem changed to:
I use function in the App. that musn't intterupted by annother thread. how
do i fix this?
I had alot of Code in a Timer and it worked pretty well if i didn't look on
the performance, and i thought to increase the performance, i put the whole
Timer-Stuff in an own Thread. Okay, did this and it didn'r work very well
anymore :( cause i call some functions in the thread those are in the
main-thread and they musn't be interuppted.
do you understand? it's pretty hard to explain :(
Eelke Klein wrote:
Quote
Ron Eggler wrote:
>Hi,
>
>I'm writing an Application with a Thread and my problem is, it
>doesn't start
>
>Okay, some code-snippets:
>I try to Start it like this:
>TThread_p->Resume();
>
>and in the Execute-Function it looks like this:
>while (!Terminated)
>
>{
>
>but if i set a Breakpoint in the while-loop, the de{*word*81} only stops
>there when i re-compile the app.
Can you explain more detailed whats happening? As far as I know you
first have to stop the de{*word*81} and application before you can
recompile.

As Liz allready pointed out including actual code which can be
compiled
will help in getting usefull answers.

Some things you could check:
Did you check Resume is actually called?
Is the breakpoint enabled? Builder might disable it because it cannot
break at the line you specified.


Eelke
 

{smallsort}

Re:Thread-Problem

Ron Eggler wrote:
Quote
Okay, know i solved this and my Problem changed to:
I use function in the App. that musn't intterupted by annother thread. how
do i fix this?
I had alot of Code in a Timer and it worked pretty well if i didn't look on
the performance, and i thought to increase the performance, i put the whole
Timer-Stuff in an own Thread. Okay, did this and it didn'r work very well
anymore :( cause i call some functions in the thread those are in the
main-thread and they musn't be interuppted.
do you understand? it's pretty hard to explain :(
Take a look at TCriticalSection.
Eelke
 

Re:Thread-Problem

Eelke Klein wrote:
Quote
Ron Eggler wrote:
>Okay, know i solved this and my Problem changed to:
>I use function in the App. that musn't intterupted by annother
>thread. how do i fix this?
>I had alot of Code in a Timer and it worked pretty well if i didn't
>look on the performance, and i thought to increase the performance,
>i put the whole Timer-Stuff in an own Thread. Okay, did this and it
>didn'r work very well anymore :( cause i call some functions in the
>thread those are in the main-thread and they musn't be interuppted.
>do you understand? it's pretty hard to explain :(
Take a look at TCriticalSection.
Olay, looks nice bu^t how do i use it with the Main-Thread?
I mean to Stop every other Thread exept the Main-Thread.
Thanx alot!
 

Re:Thread-Problem

"Ron Eggler" < XXXX@XXXXX.COM >wrote in message
Quote
I had alot of Code in a Timer and it worked pretty well if
i didn't look on the performance, and i thought to increase
the performance, i put the whole Timer-Stuff in an own
Thread. Okay, did this and it didn'r work very well anymore :(
Again, you need to show your actual code. What EXACTLY are you trying to
accomplish?
Gambit
 

Re:Thread-Problem

Ron Eggler wrote:
Quote
Eelke Klein wrote:

>Ron Eggler wrote:
>
>>Okay, know i solved this and my Problem changed to:
>>I use function in the App. that musn't intterupted by annother
>>thread. how do i fix this?
>>I had alot of Code in a Timer and it worked pretty well if i didn't
>>look on the performance, and i thought to increase the performance,
>>i put the whole Timer-Stuff in an own Thread. Okay, did this and it
>>didn'r work very well anymore :( cause i call some functions in the
>>thread those are in the main-thread and they musn't be interuppted.
>>do you understand? it's pretty hard to explain :(
>
>Take a look at TCriticalSection.


Olay, looks nice bu^t how do i use it with the Main-Thread?
I mean to Stop every other Thread exept the Main-Thread.
Thanx alot!
If the main thread shouldn't stop it shouldn't use it.
Without a good code example I can't give any good answers.
Eelke