1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help with this in c++

Discussion in 'Programming' started by [D.R.T], Aug 22, 2010.

  1. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    For some time many users reported errors in "noobiebot", that was because I used "TerminateThread", now I wanted to know if anyone knows how to solve this problem, I understand that "TerminateThread" take risks as stated in the api.

    He used it so
    Code (Text):
    2. //thread
    3. HANDLE hFuncion
    4. hFuncion = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Funcion, NULL, 0, NULL);
    6. //terminate
    7. TerminateThread(hFuncion, 0)
    if someone had a similar error, and know how to help appreciate it
  2. Tets

    Tets Well-Known Member

    What kind of problems/errors? What are you using TerminateThread for?
  3. Cuckoo

    Cuckoo Fuckeh Yuuu Donor

    it froze whenn you anticked a hack
  4. David...

    David... Banned Banned

    TerminateThread(hKami, 0);

    Teleport(iOriginalX, iOriginalY);

    Well, lol.. Works fine in my Kami bot, no?

    What are you using it for?
  5. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    only use this to terminate a thread,
    Code (Text):
    1. TerminateThread(hFuncion, 0)
    I have no problems but many users said they had problems whit tick / untick
  6. DarkSpace

    DarkSpace Well-Known Member Coder

    only reason i can think of when that happens is

    if the thread doesnt exist anymore.

    for example.

    if a thread ends it's job. isnt it auto terminated?

    lets say you have a thread

    Code (Text):
    2. void tThread()
    3. {
    4.      for(int count = 0; count < 100; count++)
    5.      {
    6.           //do something
    7.      }
    8. // after the forloop. thread got nothing else to do. so it exits it self out.
    9. }
    now if that happens, if the thread auto terminates its self. when its called by
    TerminateThread(). it doesnt exist anymore as its already closed.

    so i guess you should stick it in a try catch statament.
    Code (Text):
    2. try
    3. {
    4. TerminateThread(hFuncion, 0);
    5. }
    6. catch(...)
    7. {
    8. //do nothing as the thread might be already closed. so ingore all errors
    9. }
  7. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    thanks, I'll try later
  8. fag

    fag Banned Banned

  9. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

Share This Page