> What ctor? I can't get to the ctor of the CCriticalSection itself.
> Since it's a member of a structure and that structure is allocated
> globally (not part of a class), there is no other relevant ctor.

I meant the CCriticalSection ctor.  You could open its source file in the
MFC's src directory, and put a breakpoint there.

> Sorry, you must have missed the part where I said 'MFC'.

Well, those classes can be used with MFC classes just fine.  Please read
their docs to see if they seem to be what you're after.

> It won't let me; psQueue claims to be valid and the members show
> correctly (which appears to indicate that it has been allocated in
> memory correctly), but the debugger just won't let me single step into
> Lock().
>
> However, there is something that may explain it. The object of Class A
> that creates this worker thread is declared globally, as is the
> structure holding the critical section...
> is it possible that although the debugger seems to show the structure
> correctly, it is actually not allocated in memory at the time the
> thread tries to first access it, and so this is causing the problem?
>
> In other words, am I trying to use it before I can guarantee that all
> global objects / structures are ready?
>
> If so, then this is probably the root of my problem and I have to
> rethink the strategy.

The thread creator object creates the thread in its ctor?  If so, you're
moving with a bad design, because the initialization order of global objects
is not defined.  You could solve this by replacing the CCriticalSection
global object with this funciton:

  CCriticalSection & global_cs()
  {
   static CCriticalSection cs;
   return cs;
  }

-------------
Ehsan Akhgari

Farda Technology (http://www.farda-tech.com/)

List Owner: [EMAIL PROTECTED]

[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]

Such persons vaunt about not lying: but inability to lie is still far from
being love to truth.
-Thus Spoke Zarathustra, F. W. Nietzsche





Reply via email to