Click here to Skip to main content
14,332,720 members

ATL / WTL / STL

 
Questionerror WTL Pin
Member 104023901-Dec-13 4:42
professionalMember 104023901-Dec-13 4:42 
AnswerRe: error WTL Pin
Richard MacCutchan1-Dec-13 5:05
protectorRichard MacCutchan1-Dec-13 5:05 
GeneralRe: error WTL Pin
Member 104023901-Dec-13 7:43
professionalMember 104023901-Dec-13 7:43 
GeneralRe: error WTL Pin
Richard MacCutchan1-Dec-13 21:00
protectorRichard MacCutchan1-Dec-13 21:00 
GeneralRe: error WTL Pin
Member 104023902-Dec-13 4:57
professionalMember 104023902-Dec-13 4:57 
QuestionException handling wrapper over MSXML parser Pin
sma123#26-Nov-13 14:16
membersma123#26-Nov-13 14:16 
AnswerRe: Exception handling wrapper over MSXML parser Pin
Richard MacCutchan26-Nov-13 22:49
protectorRichard MacCutchan26-Nov-13 22:49 
Questionuse of beginthreadex() Pin
bkelly1325-Nov-13 16:24
memberbkelly1325-Nov-13 16: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 22:44
protectorRichard MacCutchan25-Nov-13 22:44 
GeneralRe: use of beginthreadex() Pin
bkelly1326-Nov-13 8:05
memberbkelly1326-Nov-13 8:05 
GeneralRe: use of beginthreadex() Pin
Richard MacCutchan26-Nov-13 22:46
protectorRichard MacCutchan26-Nov-13 22:46 
GeneralRe: use of beginthreadex() Pin
bkelly1327-Nov-13 11:45
memberbkelly1327-Nov-13 11:45 
GeneralRe: use of beginthreadex() Pin
Richard MacCutchan27-Nov-13 22:03
protectorRichard MacCutchan27-Nov-13 22:03 
GeneralRe: use of beginthreadex() Pin
bkelly1328-Nov-13 10:08
memberbkelly1328-Nov-13 10:08 
GeneralRe: use of beginthreadex() Pin
Albert Holguin11-Dec-13 5:01
professionalAlbert Holguin11-Dec-13 5:01 
Generaleasy for classes Pin
bkelly1311-Dec-13 12:27
memberbkelly1311-Dec-13 12:27 
GeneralRe: easy for classes Pin
Albert Holguin12-Dec-13 4:09
professionalAlbert Holguin12-Dec-13 4:09 
GeneralRe: easy for classes Pin
bkelly1312-Dec-13 12:53
memberbkelly1312-Dec-13 12:53 
AnswerRe: easy for classes Pin
Albert Holguin12-Dec-13 13:10
professionalAlbert Holguin12-Dec-13 13:10 
QuestionI want to showing "+" allways in WTL CTreeViewCtrl Pin
cheng84977cc25-Nov-13 5:40
membercheng84977cc25-Nov-13 5:40 
AnswerRe: I want to showing "+" allways in WTL CTreeViewCtrl Pin
Wayne.CN13-Jan-14 17:51
memberWayne.CN13-Jan-14 17:51 
Question[How to Convert data in textBox to .Txt file in Windows Form C++] Pin
Member 1041578020-Nov-13 19:53
memberMember 1041578020-Nov-13 19:53 
QuestionRe: [How to Convert data in textBox to .Txt file in Windows Form C++] Pin
Richard MacCutchan20-Nov-13 22:21
protectorRichard MacCutchan20-Nov-13 22:21 
Questionstl thread safe Pin
G.aius.CodeCreator18-Nov-13 15:38
memberG.aius.CodeCreator18-Nov-13 15:38 
Questionwaiting on events for socket activity Pin
bkelly1318-Nov-13 14:05
memberbkelly1318-Nov-13 14:05 

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.