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

C / C++ / MFC

 
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 
GeneralRe: Threads Pin
Erik Funkenbusch11-Dec-00 12:02
Erik Funkenbusch11-Dec-00 12:02 
There are numerous problems with your code:

First, in your producer thread, there's no reason for the second while loop. Since you never loop, you call break at the end of it no matter what. This can be achieved with an if statement instead.

Second, in the case of index==FULL, then you will call Unlock() twice while only calling Lock() once. That will cause all kinds of problems.

The same applies for your consumer thread.

But the real problem here is likely that you are in what's called a deadlock, or race condition. Your consumer thread is waiting in WaitForSingleObject for a packet ready event, and your producer is waiting for a buffer empty event. Since both threads are waiting at the same time, they wait indefinately.


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 
GeneralRe: Strings in compiled applications Pin
11-Dec-00 18:14
suss11-Dec-00 18:14 

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.