uintptr_t _beginthreadex(
void *security,
unsigned stack_size,
unsigned ( __stdcall *start_address )( void * ),
void *arglist,
unsigned initflag,
unsigned *thrdaddr
I want to start a thread from socket winsock
I want to create a thread from socket function
should my argument list be indirect variable to address of data item from my orginal thread? or can the arglist be any data item acessed with mdifying variable? or should arglist be from where i Began and started my thread offset base application from?
Should I use native or managed code for socket start address?
"
For /clr code, _beginthread and _beginthreadex each have two overloads. One takes a native calling-convention function pointer, and the other takes a __clrcall function pointer. The first overload isn't application domain-safe and never will be. If you're writing /clr code, you must ensure that the new thread enters the correct application domain before it accesses managed resources. You can do so, for example, by using call_in_appdomain. The second overload is application domain-safe; the newly created thread will always end up in the application domain of the caller of _beginthread or _beginthreadex.
By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.
"
I am concerned that native is not application domain safe in context of socket function thread after beginthread(). Should there be a function before beginthreadex()? should arguments passed to beginthreadex() be address to data item indirectly that alters the orginal context of the prior base thread?
arglist is a parameter to be passed to the newly created thread. Typically, it's the address of a data item, such as a character string. arglist can be NULL if it isn't needed, but _beginthread and _beginthreadex must be given some value to pass to the new thread. All threads are terminated if any thread calls abort, exit, _exit, or ExitProcess.
int thrsrt = accept(servsock, (SOCKADDR *)&servaddr,servlngth);
int thr = beginthreadex(NULL,0,thrsrt,thrdproc,NULL)
int thrdproc = accept(servsock, (SOCKADDR *)&servaddr,servlngth);
if(threadproc<<=100)
return 0;
void endthreadex()
What I have tried:
Ive tried original beginthread and compared with create thread if that helps explain the actual systematic structure Im looking for.