Re: stop Thread problem



cdg wrote:
However, I have found that it causes an compiler error
when using the bool variable in the static function of the worker thread.

The static function must use a pointer to the object when it accesses (nonstatic) members.

if (!pDlg->running)
return 0;

--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Re: Threads on class,
    ... first argument of a static function is in the stack. ... don't force cast any function pointer. ... > compiler it probably won't work. ... > member function in question is a static member. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Threads on class,
    ... first argument of a static function is in the stack. ... don't force cast any function pointer. ... > compiler it probably won't work. ... > member function in question is a static member. ...
    (microsoft.public.vc.language)
  • Re: Using Reference of Pointers
    ... > force initialisation of objects through their static function Create, ... I think hiding a pointer behind a typedef like this ... why not do the initialization in the ctor as C++ ...
    (comp.lang.cpp)
  • Re: stop Thread problem
    ... The program uses a Start button to call the worker thread. ... when using the bool variable in the static function of the worker thread. ... Your use of a boolean flag is fine. ... by the CThreadTestDlg object and Thread1. ...
    (microsoft.public.vc.mfc)
  • Re: Methods and Threading
    ... as GPIBDevice1, 2, and the a static text member in the form (all of ... Therefore, using a static member ... That problem is easy to solve: Pass your class 'this' pointer as the thread parameter. ... The static function can then use the pointer to call a nonstatic function. ...
    (microsoft.public.vc.mfc)