Click here to Skip to main content
14,391,319 members

ATL / WTL / STL

 
GeneralRe: Winsock Peer to Peer using UDP and TCP Pin
SoMad10-Jan-14 9:56
professionalSoMad10-Jan-14 9:56 
GeneralRe: Winsock Peer to Peer using UDP and TCP Pin
bkelly1319-Jan-14 10:28
Memberbkelly1319-Jan-14 10:28 
Generallink error 1104 Pin
Prasun Hazra 5-Jan-14 9:15
MemberPrasun Hazra 5-Jan-14 9:15 
GeneralRe: link error 1104 Pin
Richard MacCutchan5-Jan-14 23:16
mveRichard MacCutchan5-Jan-14 23:16 
GeneralRe: link error 1104 Pin
Prasun Hazra 8-Jan-14 0:10
MemberPrasun Hazra 8-Jan-14 0:10 
GeneralRe: link error 1104 Pin
Richard MacCutchan8-Jan-14 0:25
mveRichard MacCutchan8-Jan-14 0:25 
AnswerRe: link error 1104 Pin
Albert Holguin8-Jan-14 18:11
professionalAlbert Holguin8-Jan-14 18:11 
QuestionHow to create and register two dlls with same name?(VS 2010) Pin
J_Me10-Dec-13 22:43
professionalJ_Me10-Dec-13 22:43 
AnswerRe: How to create and register two dlls with same name?(VS 2010) Pin
Richard MacCutchan10-Dec-13 23:21
mveRichard MacCutchan10-Dec-13 23:21 
GeneralRe: How to create and register two dlls with same name?(VS 2010) Pin
J_Me11-Dec-13 0:53
professionalJ_Me11-Dec-13 0:53 
GeneralRe: How to create and register two dlls with same name?(VS 2010) Pin
Richard MacCutchan11-Dec-13 1:12
mveRichard MacCutchan11-Dec-13 1:12 
AnswerRe: How to create and register two dlls with same name?(VS 2010) Pin
Albert Holguin11-Dec-13 6:02
professionalAlbert Holguin11-Dec-13 6:02 
AnswerRe: How to create and register two dlls with same name?(VS 2010) Pin
Vi219-Dec-13 23:00
MemberVi219-Dec-13 23:00 
Questionerror WTL Pin
Member 104023901-Dec-13 5:42
professionalMember 104023901-Dec-13 5:42 
AnswerRe: error WTL Pin
Richard MacCutchan1-Dec-13 6:05
mveRichard MacCutchan1-Dec-13 6:05 
GeneralRe: error WTL Pin
Member 104023901-Dec-13 8:43
professionalMember 104023901-Dec-13 8:43 
GeneralRe: error WTL Pin
Richard MacCutchan1-Dec-13 22:00
mveRichard MacCutchan1-Dec-13 22:00 
GeneralRe: error WTL Pin
Member 104023902-Dec-13 5:57
professionalMember 104023902-Dec-13 5:57 
QuestionException handling wrapper over MSXML parser Pin
sma123#26-Nov-13 15:16
Membersma123#26-Nov-13 15:16 
AnswerRe: Exception handling wrapper over MSXML parser Pin
Richard MacCutchan26-Nov-13 23:49
mveRichard MacCutchan26-Nov-13 23:49 
Questionuse of beginthreadex() Pin
bkelly1325-Nov-13 17:24
Memberbkelly1325-Nov-13 17:24 
Windows 7, Visual Studio 2008, C++, not managed code

So far, it seems that the best way to start a thread is with this:

uintptr_t _beginthreadex( // NATIVE CODE
   void *security,
   unsigned stack_size,
   unsigned ( __stdcall *start_address )( void * ),
   void *arglist,
   unsigned initflag,
   unsigned *thrdaddr
);


found here: http://msdn.microsoft.com/en-us/library/kdzttdcb(v=vs.90).aspx[^]

I found the article in CodeProject about starting a class as the thread and am using that.
The one argument to the thread is the address of a structure used to pass data between the main app and the thread. Call it common_structure. The method that will be started is Main_TCP_Class( void * common_struct ){...} (This class will handle my TCP/IP work and that thread will run for the duration so it seems Main_TCP_Class() is an aptly descriptive name.)

Question: Does the act of starting the thread with _beginthreadex(...) instantiate the class? If not, there will be some follow up questions on this.

If so, that would mean, I presume, that the constructor runs before method Main_TCP_Class() runs. And that means that none of the data in common_structure is accessible until Main_TCP_Class has started and has captured the pointer in the argument.

Is this correct? Any pitfalls that I should be aware of?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/

AnswerRe: use of beginthreadex() Pin
Richard MacCutchan25-Nov-13 23:44
mveRichard MacCutchan25-Nov-13 23:44 
GeneralRe: use of beginthreadex() Pin
bkelly1326-Nov-13 9:05
Memberbkelly1326-Nov-13 9:05 
GeneralRe: use of beginthreadex() Pin
Richard MacCutchan26-Nov-13 23:46
mveRichard MacCutchan26-Nov-13 23:46 
GeneralRe: use of beginthreadex() Pin
bkelly1327-Nov-13 12:45
Memberbkelly1327-Nov-13 12:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.