Page 1 of 1

TThread->Suspend conflict???

Posted: Wed May 12, 2004 9:55 am
by Hermit
I've a problem with CPU utilization.

After added tsiComponents to my app something strange happend with thread executing (code without tsilang works propertly).

Resuming thread is called 8 times per second by:

Code: Select all

myThread->Resume();
CPU enter into infinitive loop in myThread::Execute() even in such simple function as below:

Code: Select all

void __fastcall TOggComponent::Execute()
{
  while (!Terminated)
  {
    CanLink = true;
    Suspend();
  }//end while (!Terminated)
}

Problem is connected with suspending thread - it does't free CPU but rerun execute method (WITHOUT WAITING FOR CALLING RESUME). It works like (pseudocode below):

Code: Select all

void __fastcall TOggComponent::Execute()
{
  while(1)
  {
    while (!Terminated)
    {
      CanLink = true;
      Suspend();
    }//end while (!Terminated)
  }
}
Any of the functions calling inside Execute() don't interact with any of tsilang component (on the other hand) - calling execute body as non threaded function works propertly.

I've BCB 6.0 Prof + SP2 & TsiLang Demo Component 5.2.5

thanks for help

Posted: Thu May 13, 2004 5:13 am
by isiticov
Does removing TsiLang components solves the problem? I believe - not. It definitely looks like there is problem somewhere in your code.