Click here to Skip to main content
14,367,615 members

ATL / WTL / STL

 
AnswerRe: use of beginthreadex() Pin
Richard MacCutchan25-Nov-13 23:44
protectorRichard 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
protectorRichard MacCutchan26-Nov-13 23:46 
GeneralRe: use of beginthreadex() Pin
bkelly1327-Nov-13 12:45
memberbkelly1327-Nov-13 12:45 
GeneralRe: use of beginthreadex() Pin
Richard MacCutchan27-Nov-13 23:03
protectorRichard MacCutchan27-Nov-13 23:03 
GeneralRe: use of beginthreadex() Pin
bkelly1328-Nov-13 11:08
memberbkelly1328-Nov-13 11:08 
GeneralRe: use of beginthreadex() Pin
Albert Holguin11-Dec-13 6:01
professionalAlbert Holguin11-Dec-13 6:01 
Generaleasy for classes Pin
bkelly1311-Dec-13 13:27
memberbkelly1311-Dec-13 13:27 
I used the phrase of start a thread from a class to indicate that a particular class, such as a TCP/IP manager class, be started as a separate thread from the main app. It turns out there are some difficulties and while relatively simple to execute, I find the code difficult to read. In particular the solutions I found have a difficult to fathom pointer cast and must have a static function used to fire it off.

HOWEVER: I just discovered a way to completely bypass that problem. Begin with the class, which of course has a single method, call it main_method() that will loop as needed and not exit until the purpose is complete. Then write a simple free standing procedure. All that procedure does is instantiate the class then call main_method(). It takes one line to instantiate the class and one to call the method. When the method returns, the next line of code deletes the class and one more calls _endthreadex() to formally end the thread. That is really trivial but none of the articles I read about present this concept. (And yes, this completely ignores communications between the thread and the main app, but that is also not so difficult.)

Does anyone know of any disadvantage to this?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/

GeneralRe: easy for classes Pin
Albert Holguin12-Dec-13 5:09
professionalAlbert Holguin12-Dec-13 5:09 
GeneralRe: easy for classes Pin
bkelly1312-Dec-13 13:53
memberbkelly1312-Dec-13 13:53 
AnswerRe: easy for classes Pin
Albert Holguin12-Dec-13 14:10
professionalAlbert Holguin12-Dec-13 14:10 
QuestionI want to showing "+" allways in WTL CTreeViewCtrl Pin
cheng84977cc25-Nov-13 6:40
membercheng84977cc25-Nov-13 6:40 
AnswerRe: I want to showing "+" allways in WTL CTreeViewCtrl Pin
Wayne.CN13-Jan-14 18:51
memberWayne.CN13-Jan-14 18:51 
Question[How to Convert data in textBox to .Txt file in Windows Form C++] Pin
Member 1041578020-Nov-13 20:53
memberMember 1041578020-Nov-13 20:53 
QuestionRe: [How to Convert data in textBox to .Txt file in Windows Form C++] Pin
Richard MacCutchan20-Nov-13 23:21
protectorRichard MacCutchan20-Nov-13 23:21 
Questionstl thread safe Pin
G.aius.CodeCreator18-Nov-13 16:38
memberG.aius.CodeCreator18-Nov-13 16:38 
Questionwaiting on events for socket activity Pin
bkelly1318-Nov-13 15:05
memberbkelly1318-Nov-13 15:05 
AnswerRe: waiting on events for socket activity Pin
Orjan Westin20-Nov-13 0:03
professionalOrjan Westin20-Nov-13 0:03 
GeneralRe: waiting on events for socket activity Pin
bkelly1325-Nov-13 17:08
memberbkelly1325-Nov-13 17:08 
GeneralRe: waiting on events for socket activity Pin
Orjan Westin26-Nov-13 0:01
professionalOrjan Westin26-Nov-13 0:01 
GeneralRe: waiting on events for socket activity Pin
bkelly1326-Nov-13 9:07
memberbkelly1326-Nov-13 9:07 
QuestionWhat is the window argument in WSAAsyncSelect(...) Pin
bkelly1310-Nov-13 16:59
memberbkelly1310-Nov-13 16:59 
AnswerRe: What is the window argument in WSAAsyncSelect(...) Pin
Richard MacCutchan10-Nov-13 22:08
protectorRichard MacCutchan10-Nov-13 22:08 
Generalcreate a window for callbacks Pin
bkelly1311-Nov-13 3:00
memberbkelly1311-Nov-13 3:00 
GeneralRe: create a window for callbacks Pin
Richard MacCutchan11-Nov-13 4:01
protectorRichard MacCutchan11-Nov-13 4:01 

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.