Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: EXE/DLL resources modification? Pin
ThatsAlok18-Feb-06 0:03
ThatsAlok18-Feb-06 0:03 
GeneralRe: EXE/DLL resources modification? Pin
James R. Twine17-Feb-06 3:40
James R. Twine17-Feb-06 3:40 
GeneralRe: EXE/DLL resources modification? Pin
Blake Miller17-Feb-06 4:22
Blake Miller17-Feb-06 4:22 
AnswerRe: EXE/DLL resources modification? Pin
Michael Dunn17-Feb-06 8:59
sitebuilderMichael Dunn17-Feb-06 8:59 
QuestionWSAAsyncSelect Linux Equivalent Pin
Jnewg517-Feb-06 2:43
Jnewg517-Feb-06 2:43 
AnswerRe: WSAAsyncSelect Linux Equivalent Pin
Jnewg517-Feb-06 2:47
Jnewg517-Feb-06 2:47 
GeneralRe: WSAAsyncSelect Linux Equivalent Pin
Jnewg517-Feb-06 2:48
Jnewg517-Feb-06 2:48 
QuestionCSingleLock problem Pin
ledallam17-Feb-06 2:30
ledallam17-Feb-06 2:30 
Hi,

I am working with threads. I have a thread safe class as shown below.
class CUxx_MS_ListWordToPtr
{
// VARIABLE DECLARATION SECTION

public:
private:
//##ModelId=38BB19E501C9
CUxx_MS_CriticalSection m_Lockable;
//##ModelId=38BB19E501B5
CMapWordToPtr* m_List;
CSemaphore threadlock;


// FUNCTION DECLARATION SECTION

public:

// Construction
//##ModelId=38BB19E50291
CUxx_MS_ListWordToPtr(int nBlockSize = 10)
{

m_List = new CMapWordToPtr(nBlockSize);
}

// lock functions
//##ModelId=38BB19E50290
void Lock()
{
m_Lockable.Lock();
}
//##ModelId=38BB19E50287
void Unlock()
{
m_Lockable.Unlock();
}

// Attributes
// number of elements
//##ModelId=38BB19E50286
int GetCount() const
{
//CUxx_MS_Lock localLock((class CUxx_MS_LockableObject *) &m_Lockable);
// CUxx_MS_CriticalSection cs;
CSingleLock singleLock( (CSyncObject*)&threadlock);
singleLock.Lock();
int count = m_List->GetCount();;
singleLock.Unlock();
return count;

}
//##ModelId=38BB19E5027D
int GetCountNoLock() const
{
return m_List->GetCount();
}
//##ModelId=38BB19E5027C
BOOL IsEmpty() const
{
//CUxx_MS_Lock localLock((class CUxx_MS_LockableObject *) &m_Lockable);
CSingleLock singleLock( (CSyncObject*)&threadlock);
singleLock.Lock();
BOOL flag = m_List->IsEmpty();
singleLock.Unlock();
return flag;

}
//##ModelId=38BB19E50274
BOOL IsEmptyNoLock() const
{
return m_List->IsEmpty();
}

........

}

The way I use this class is
CTypedPtrMap<cuxx_ms_listptrtoptr, cmemmapmgr*,="" cstring*=""> ListOutput;

when I call methods like,
CString* pCStr;
CMemMapMgr* pCommunicationObject;
ListOutput.Lookup(*pCStr, pCommObject), sometimes it shows an error message->
The instruction at ".." referenced memory at " ", The memory could not be read and when I debug the code, it shows the root as
BOOL CSingleLock::Lock(DWORD dwTimeOut /* = INFINITE */)
{
ASSERT(m_pObject != NULL || m_hObject != NULL);
ASSERT(!m_bAcquired);

m_bAcquired = m_pObject->Lock(dwTimeOut);
return m_bAcquired;
}

Can anyone please help me to understand the reason for this crash and how to resolve this one?

Thanks
AnswerRe: CSingleLock problem Pin
James R. Twine17-Feb-06 3:43
James R. Twine17-Feb-06 3:43 
AnswerRe: CSingleLock problem Pin
James R. Twine17-Feb-06 3:44
James R. Twine17-Feb-06 3:44 
QuestionMulti-tasking and threads Pin
theprinc17-Feb-06 2:12
theprinc17-Feb-06 2:12 
AnswerRe: Multi-tasking and threads Pin
David Crow17-Feb-06 2:32
David Crow17-Feb-06 2:32 
QuestionRe: Multi-tasking and threads Pin
theprinc17-Feb-06 2:42
theprinc17-Feb-06 2:42 
AnswerRe: Multi-tasking and threads Pin
Cedric Moonen17-Feb-06 2:49
Cedric Moonen17-Feb-06 2:49 
AnswerRe: Multi-tasking and threads Pin
David Crow17-Feb-06 2:51
David Crow17-Feb-06 2:51 
GeneralRe: Multi-tasking and threads Pin
theprinc17-Feb-06 3:01
theprinc17-Feb-06 3:01 
GeneralRe: Multi-tasking and threads Pin
David Crow17-Feb-06 3:10
David Crow17-Feb-06 3:10 
GeneralRe: Multi-tasking and threads Pin
theprinc17-Feb-06 3:25
theprinc17-Feb-06 3:25 
QuestionRe: Multi-tasking and threads Pin
David Crow17-Feb-06 3:27
David Crow17-Feb-06 3:27 
AnswerRe: Multi-tasking and threads Pin
theprinc17-Feb-06 3:59
theprinc17-Feb-06 3:59 
GeneralRe: Multi-tasking and threads Pin
David Crow17-Feb-06 4:26
David Crow17-Feb-06 4:26 
QuestionFrame Pane Fixing Problem! Pin
Temp8317-Feb-06 1:48
Temp8317-Feb-06 1:48 
AnswerRe: Frame Pane Fixing Problem! Pin
Cedric Moonen17-Feb-06 2:06
Cedric Moonen17-Feb-06 2:06 
AnswerRe: Frame Pane Fixing Problem! Pin
David Crow17-Feb-06 2:34
David Crow17-Feb-06 2:34 
AnswerRe: Frame Pane Fixing Problem! Pin
Russell'17-Feb-06 2:43
Russell'17-Feb-06 2:43 

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.