Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Looking for an advice about password authentication Pin
mark novak28-Jul-05 4:45
mark novak28-Jul-05 4:45 
QuestionIs there a #define for Multi-Threading? Pin
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX28-Jul-05 1:02
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX28-Jul-05 1:02 
AnswerRe: Is there a #define for Multi-Threading? Pin
berndg28-Jul-05 2:15
berndg28-Jul-05 2:15 
GeneralRe: Is there a #define for Multi-Threading? Pin
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX28-Jul-05 4:21
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX28-Jul-05 4:21 
GeneralRe: Is there a #define for Multi-Threading? Pin
berndg28-Jul-05 4:27
berndg28-Jul-05 4:27 
AnswerRe: Is there a #define for Multi-Threading? Pin
Blake Miller28-Jul-05 5:09
Blake Miller28-Jul-05 5:09 
GeneralRe: Is there a #define for Multi-Threading? Pin
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX28-Jul-05 5:19
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX28-Jul-05 5:19 
AnswerRe: Is there a #define for Multi-Threading? Pin
Bob Stanneveld28-Jul-05 5:22
Bob Stanneveld28-Jul-05 5:22 
If you use this kind of macro magic just to implement your synchronization, this is bad! It is better to define a helper class that implements your lock, and define a macro that creates the lock or does nothing depending on the _MT switch.

Example:
class CSemaphoreLock
{
public:
    CSemaphoreLock(HANDLE hSem) : m_hSem(hSem) { ::WaitForSingleObject(hSem, INFINITE); }
    ~CSemaphoreLock() { ::ReleaseSemaphore(m_hSem, 1, NULL); }

private:
    const HANDLE m_hSem;
};

#ifdef _MT
#  define SEMAPHORE_LOCK(HSEM) CSemaphoreLock TempLock_(HSEM)
#else
#  define SEMAPHORE_LOCK(HSEM)
#endif // _MT



Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
AnswerRe: Is there a #define for Multi-Threading? Pin
Alexander M.,28-Jul-05 8:53
Alexander M.,28-Jul-05 8:53 
QuestionTool to generate API doc spec? Pin
huutribk200128-Jul-05 0:09
huutribk200128-Jul-05 0:09 
AnswerRe: Tool to generate API doc spec? Pin
mark novak28-Jul-05 0:30
mark novak28-Jul-05 0:30 
AnswerRe: Tool to generate API doc spec? Pin
Marc Soleda28-Jul-05 0:30
Marc Soleda28-Jul-05 0:30 
AnswerRe: Tool to generate API doc spec? Pin
Ravi Bhavnani28-Jul-05 1:37
professionalRavi Bhavnani28-Jul-05 1:37 
AnswerRe: Tool to generate API doc spec? Pin
huutribk200128-Jul-05 22:28
huutribk200128-Jul-05 22:28 
Generalc++ Pin
Nishad S28-Jul-05 0:03
Nishad S28-Jul-05 0:03 
GeneralRe: c++ Pin
Mohammed F. Salem28-Jul-05 0:12
Mohammed F. Salem28-Jul-05 0:12 
GeneralRe: c++ Pin
toxcct28-Jul-05 0:39
toxcct28-Jul-05 0:39 
GeneralRe: c++ Pin
Ravi Bhavnani28-Jul-05 1:39
professionalRavi Bhavnani28-Jul-05 1:39 
GeneralRe: c++ Pin
David Crow28-Jul-05 5:16
David Crow28-Jul-05 5:16 
GeneralRe: c++ Pin
Alexander M.,28-Jul-05 9:09
Alexander M.,28-Jul-05 9:09 
GeneralVC Profiler Pin
RChin27-Jul-05 23:58
RChin27-Jul-05 23:58 
GeneralRe: VC Profiler Pin
Jack Puppy28-Jul-05 0:21
Jack Puppy28-Jul-05 0:21 
GeneralRe: VC Profiler Pin
RChin28-Jul-05 1:58
RChin28-Jul-05 1:58 
GeneralRe: VC Profiler Pin
Giles28-Jul-05 6:36
Giles28-Jul-05 6:36 
GeneralSearching for help on-line Pin
onlysaint27-Jul-05 23:54
onlysaint27-Jul-05 23:54 

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.