CreateThread (someTimes run ok and other it doesn't)

Hi!
This is my first post.

I'm programming a TCP communication module with Visual Studio 2010.

I create a client object and before the constructor ends I create a thread:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
DWORD WINAPI function(void *args){
  client * = (client *)args;

  while(true){
      // do things

  }
  ExitThread(0);
}

class client{

  ...

  client(){
    //Initialize object
    ...
    Handle mTh = CreateThread(NULL,0,function,(void *)this,0, (LPDWORD)&th);

  }

}
 


This code is in a .dll and the constructor class is called from other .dll (a.dll for example) using LoadLibrary and GetProcAddress.

If a.dll is called from myapp.exe, it runs ok and the thread is created, but if a.dll is called from anyAppSystem.exe all runs ok but the thread is not created.

I was thinking the problem was the thread security level but I don't have any idea...

Thanks for your help
Topic archived. No new replies allowed.