Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Re: TThread, Te...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 24 Topic 5165 of 5187
Post > Topic >>

Re: TThread, Terminate, Boolean, Alignment ???

by "Skybuck Flying" <BloodyShame@[EMAIL PROTECTED] > Oct 14, 2008 at 07:36 PM

What the **** ?!?!

Outlook express completely messed up the last message ?!?!

Wow what the **** ?!?

Let's try that again:

It's amazing how my brain manages to solve problems while I am asleep.

"Yesterday" I was tired and I didn't see the problem.

"Today" I wake up and immediatly understand the problem.

At least I think so...

Problem description:

There are two threads:

ThreadMain
ThreadTest

The code which they execute is
(which I will put side-by-side, for illustration):


ThreadMain                ThreadTest
begin                     begin
  ThreadTest.Terminate;     while not Terminated do
  ThreadTest.WaitFor;       begin
  ThreadTest.Free;          end;
end;                       end;

The order in which these statements are executed is probably what is
causing
the problem in rare cases.

The rare case would be:

1. ThreadMain ThreadTest.Terminate;
2. ThreadTest.while not Terminated do
3. ThreadMain ThreadTest.WaitFor;

So you see the problem now ?

I do, the problem is:

First ThreadMain tells ThreadTest to terminate, then ThreadTest immediatly
terminates.

Then ThreadMain tries to wait for ThreadTest to terminate... but it
already
terminated ?!

So ThreadMain waits forever on ThreadTest to terminate !

That's why it can never work ?!

So if I am correct about this then CodeGear has had a bug in there thread
code up to this day....

Which is about 10 years or so ?!

This bug is still in Delphi 2009 ?! WOW.

Which more or less proves how difficult it can be to find/detect bugs.

^^^ Probably caused by their bad testing as well ;) :) ^^^

I solved this with a critical section for the terminated boolean...

Maybe there is a better/more efficient solution ???

On a side note:

I left my computer running the whole "night" because it's downloading
Brother in Arms: Hells highway :)

Also Call of Duty 5 will come out 8 days from now ? So that gonna be fun
too
lol. Gonna be busy gaming weeks :)

Anyway something happened to my computer when I was a sleep and
downloading
with BitComet 0.63 or so:

BitComet is still working... but Explorer.EXE crashes with an unknown
exception... probably in the .NET section or so ;)

I hope my computer didn't get hacked or infected ;) Maybe it was just a
failed hack attempt but this shows Windows X64 still has some serious bugs
here and there... (Explorer.exe hangs sometimes too...)

I restarted explorer.exe so now everything is fine...

Today Microsoft is probably gonna patch some holes...  I always wait a
little bit with patching the operating system with new patches... One
never
knows how that works out... sometimes people have problems with new
patches
so that's why I always wait a few days or weeks... to know if the patches
work ok or not ok ;) :)

Bye,
  Skybuck ! =D
 




 24 Posts in Topic:
TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 12:19:39 
Re: TThread, Terminate, Boolean, Alignment ???
Szabolcs Ferenczi <sza  2008-10-14 03:50:11 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:33:26 
Re: TThread, Terminate, Boolean, Alignment ???
David Schwartz <davids  2008-10-14 04:49:57 
Re: TThread, Terminate, Boolean, Alignment ???
"Chris M. Thomasson&  2008-10-14 13:50:52 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:30:38 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:36:00 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:38:46 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:40:44 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:51:22 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:51:56 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 19:57:37 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 20:55:38 
Re: TThread, Terminate, Boolean, Alignment ???
Rob Kennedy <me3@[EMAI  2008-10-14 14:12:10 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-14 21:58:09 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-15 01:30:16 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-15 04:17:12 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-15 04:19:51 
Re: TThread, Terminate, Boolean, Alignment ???
"Skybuck Flying"  2008-10-15 04:37:46 
Re: TThread, Terminate, Boolean, Alignment ???
"Nicholas Ring"  2008-10-15 21:12:44 
Re: TThread, Terminate, Boolean, Alignment ???
David Schwartz <davids  2008-10-14 18:31:57 
Re: TThread, Terminate, Boolean, Alignment ???
"Chris M. Thomasson&  2008-10-15 19:55:49 
Re: TThread, Terminate, Boolean, Alignment ???
"Chris M. Thomasson&  2008-10-15 21:42:35 
Re: TThread, Terminate, Boolean, Alignment ???
"Chris M. Thomasson&  2008-10-15 21:46:57 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 16:38:09 CST 2008.