Click here to Skip to main content
15,911,786 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Modeless dialog box doesn't have focus when created Pin
11-Dec-00 16:57
suss11-Dec-00 16:57 
GeneralRe: Modeless dialog box doesn't have focus when created Pin
Christian Graus12-Dec-00 10:04
protectorChristian Graus12-Dec-00 10:04 
GeneralHandle of edit control Pin
11-Dec-00 10:03
suss11-Dec-00 10:03 
GeneralHandle of edit control Pin
11-Dec-00 10:02
suss11-Dec-00 10:02 
GeneralRe: Handle of edit control Pin
Ancient Dragon11-Dec-00 14:35
Ancient Dragon11-Dec-00 14:35 
GeneralCString and BSTR in WinCE Pin
Mel Stober11-Dec-00 8:53
Mel Stober11-Dec-00 8:53 
GeneralRe: CString and BSTR in WinCE Pin
Erik Funkenbusch11-Dec-00 11:54
Erik Funkenbusch11-Dec-00 11:54 
GeneralThreads Pin
11-Dec-00 6:08
suss11-Dec-00 6:08 
Hi
I have a producer thread of the following form:

while (1)
{
g_cs.Lock();

if (GetPkt()) g_PktEvent.SetEvent();
while (index==FULL)
{
g_cs.Unlock();
WaitForSingleObject(g_BufferEmptyEvent,INFINITE);
break;
}
g_cs.Unlock();
}

and a consumer thread as follows:

while (1)
{
g_cs.Lock();

if (index>0) g_BufferEmptyEvent.SetEvent();
while (index==0)
{
g_cs.Unlock();
WaitForSingleObject(g_PktEvent,INFINITE);
break;
}
g_cs.Unlock();
}

When I run the program, the threads block after some time (the buffer remains empty). The producer thread does not produce any pkt to place in the buffer.

Can anyone please help me find out where the bug is?

Thanks a lot
GeneralRe: Threads Pin
Erik Funkenbusch11-Dec-00 12:02
Erik Funkenbusch11-Dec-00 12:02 
GeneralRe: Threads Pin
11-Dec-00 22:13
suss11-Dec-00 22:13 
GeneralRe: Threads Pin
Erik Funkenbusch12-Dec-00 12:01
Erik Funkenbusch12-Dec-00 12:01 
GeneralHibernating Pin
11-Dec-00 4:36
suss11-Dec-00 4:36 
GeneralBitmap handling Pin
Thomas T.11-Dec-00 4:10
Thomas T.11-Dec-00 4:10 
GeneralChanging the caption of start button Pin
11-Dec-00 3:27
suss11-Dec-00 3:27 
GeneralRe: Changing the caption of start button Pin
Erik Funkenbusch11-Dec-00 12:09
Erik Funkenbusch11-Dec-00 12:09 
GeneralRe: Changing the caption of start button Pin
SpiderMan11-Dec-00 13:43
SpiderMan11-Dec-00 13:43 
GeneralAbout creating Voice recognition software Pin
11-Dec-00 3:20
suss11-Dec-00 3:20 
GeneralRe: About creating Voice recognition software Pin
Brendan Tregear11-Dec-00 17:06
Brendan Tregear11-Dec-00 17:06 
Generalabout Font creattion using VC++ Pin
11-Dec-00 3:17
suss11-Dec-00 3:17 
GeneralRe: about Font creattion using VC++ Pin
12-Dec-00 18:23
suss12-Dec-00 18:23 
GeneralStrings in compiled applications Pin
Hanselmann11-Dec-00 3:20
Hanselmann11-Dec-00 3:20 
GeneralRe: Strings in compiled applications Pin
SAWilde11-Dec-00 7:24
SAWilde11-Dec-00 7:24 
GeneralRe: Strings in compiled applications Pin
Jim Howard11-Dec-00 9:37
Jim Howard11-Dec-00 9:37 
GeneralRe: Strings in compiled applications Pin
Jim Howard18-Dec-00 5:26
Jim Howard18-Dec-00 5:26 
GeneralRe: Strings in compiled applications Pin
Erik Funkenbusch11-Dec-00 12:11
Erik Funkenbusch11-Dec-00 12:11 

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.