Confused about the usage of Critical Section ..
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 11 of 11

Thread: Confused about the usage of Critical Section ..

Threaded View

  1. #1
    Join Date
    Jan 2012

    Confused about the usage of Critical Section ..

    I am using a thread in my application .. A DLL is written for In and Out instructions for hardware ICS and to read FIFO.

    My code is

    CCriticalSection crdll , crsec ;

    UINT ThreadReceiveData(LPVOID param)

    for ( ; ; ) {

    if (bTerminate) break; // bTerminate = 1 in Doc template destructor


    do {

    read data ;

    if ( data is not valid) break;


    if (data of type 1) process data;



    if (data of type 2) process data;


    } while valid data



    return 1;


    I am confused , how and when I should use Ctitical Section ? The program works fine but I am
    not happy as this is main routine of the program and I have not understood it properly.

    PL GUIDE ..
    Last edited by new_2012; December 12th, 2012 at 05:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center