Click here to Skip to main content
15,887,585 members
Home / Discussions / ATL / WTL / STL
   

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
mveRichard 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
mveRichard 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
sma123#26-Nov-13 14:16 
AnswerRe: Exception handling wrapper over MSXML parser Pin
Richard MacCutchan26-Nov-13 22:49
mveRichard MacCutchan26-Nov-13 22:49 
Questionuse of beginthreadex() Pin
bkelly1325-Nov-13 16:24
bkelly1325-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:

C#
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
mveRichard MacCutchan25-Nov-13 22:44 
GeneralRe: use of beginthreadex() Pin
bkelly1326-Nov-13 8:05
bkelly1326-Nov-13 8:05 
GeneralRe: use of beginthreadex() Pin
Richard MacCutchan26-Nov-13 22:46
mveRichard MacCutchan26-Nov-13 22:46 
GeneralRe: use of beginthreadex() Pin
bkelly1327-Nov-13 11:45
bkelly1327-Nov-13 11:45 
GeneralRe: use of beginthreadex() Pin
Richard MacCutchan27-Nov-13 22:03
mveRichard MacCutchan27-Nov-13 22:03 
GeneralRe: use of beginthreadex() Pin
bkelly1328-Nov-13 10:08
bkelly1328-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
bkelly1311-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
bkelly1312-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
cheng84977cc25-Nov-13 5:40 
AnswerRe: I want to showing "+" allways in WTL CTreeViewCtrl Pin
Wayne.CN13-Jan-14 17:51
Wayne.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
Member 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
mveRichard MacCutchan20-Nov-13 22:21 
Questionstl thread safe Pin
G.aius.CodeCreator18-Nov-13 15:38
G.aius.CodeCreator18-Nov-13 15:38 
Questionwaiting on events for socket activity Pin
bkelly1318-Nov-13 14:05
bkelly1318-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.