Click here to Skip to main content
15,912,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: NEW CONTROLS... Pin
Prakash Nadar10-Apr-04 5:21
Prakash Nadar10-Apr-04 5:21 
GeneralSporder.exe on Win98 Pin
Kuniva10-Apr-04 1:09
Kuniva10-Apr-04 1:09 
GeneralFonts, texts ... Pin
Ni@m10-Apr-04 1:06
Ni@m10-Apr-04 1:06 
GeneralRe: Fonts, texts ... Pin
toxcct10-Apr-04 1:48
toxcct10-Apr-04 1:48 
GeneralRe: Fonts, texts ... Pin
niam10-Apr-04 2:16
niam10-Apr-04 2:16 
GeneralRe: Fonts, texts ... Pin
toxcct10-Apr-04 2:43
toxcct10-Apr-04 2:43 
GeneralRe: Fonts, texts ... Pin
avenger_sb2510-Apr-04 17:21
avenger_sb2510-Apr-04 17:21 
Generalmaking a class thread safe Pin
packetlos10-Apr-04 0:51
packetlos10-Apr-04 0:51 
Hi,

I am trying to make my class thread safe with out much luck and wonder if anybody can point me in the right direction. An object of this class is shared between 2 threads, therefore I have added some critical sections but in testing this does not seem to be enough, below is what i have so far:

void CPacket::Lock()
{
  CSingleLock singleLock(&m_CList);
  singleLock.Lock();
  ASSERT(singleLock.IsLocked());
}

void CPacket::Unlock()
{
  CSingleLock singleLock(&m_CList);
  singleLock.Unlock();
  ASSERT(!singleLock.IsLocked());
}

and in my code around all use of the object:
m_capturedPacket->Lock();
m_capturedPacket->Addpacket() // do something
m_capturedPacket->Unlock();

Internally the class mainatins a CList which is being corrupted, how can I make calls to this class thread safe?
GeneralRe: making a class thread safe Pin
Gary R. Wheeler10-Apr-04 2:11
Gary R. Wheeler10-Apr-04 2:11 
GeneralSystemtray + compiling Pin
Geert van Horrik10-Apr-04 0:35
Geert van Horrik10-Apr-04 0:35 
Generalservice problem!!! Pin
tank10259-Apr-04 23:43
tank10259-Apr-04 23:43 
GeneralRe: service problem!!! Pin
Mikko Puonti9-Apr-04 23:58
Mikko Puonti9-Apr-04 23:58 
GeneralRe: service problem!!! Pin
tank102510-Apr-04 0:05
tank102510-Apr-04 0:05 
GeneralMaximize dialog based app on startup Pin
pma9-Apr-04 23:15
pma9-Apr-04 23:15 
GeneralRe: Maximize dialog based app on startup Pin
Prakash Nadar9-Apr-04 23:35
Prakash Nadar9-Apr-04 23:35 
GeneralRe: Maximize dialog based app on startup Pin
ThatsAlok9-Apr-04 23:36
ThatsAlok9-Apr-04 23:36 
GeneralFind The type of Internet Connection.... Pin
swarnamanoo9-Apr-04 23:10
swarnamanoo9-Apr-04 23:10 
GeneralProblem accessing one class from another and vice versa Pin
Iceberg769-Apr-04 20:34
Iceberg769-Apr-04 20:34 
GeneralRe: Problem accessing one class from another and vice versa Pin
toxcct9-Apr-04 21:39
toxcct9-Apr-04 21:39 
GeneralRe: Problem accessing one class from another and vice versa Pin
toxcct9-Apr-04 21:51
toxcct9-Apr-04 21:51 
GeneralClipboard copy Pin
Member 60749-Apr-04 20:32
Member 60749-Apr-04 20:32 
GeneralRe: Clipboard copy Pin
ThatsAlok9-Apr-04 23:43
ThatsAlok9-Apr-04 23:43 
GeneralFormating output file Pin
picasso29-Apr-04 19:28
picasso29-Apr-04 19:28 
GeneralRe: Formating output file Pin
Prakash Nadar9-Apr-04 19:51
Prakash Nadar9-Apr-04 19:51 
QuestionActive Window? Pin
David Horner9-Apr-04 18:54
David Horner9-Apr-04 18: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.