Avatar of _kp
Flag for United States of America asked on

Deadlock problem using AfxBeginThread

I have a modeless dialog that I spawn a seperate thread using m_hGThread1=AfxBeginThread(Animate_Graph,0,THREAD_PRIORITY_NORMAL,0,0,NULL) to handle the graphics seperately from the dialog. I'm using a critical section for locking. Under stress testing it deadlocks the application. Using VC7/MFC. What am I doing wrong?

Avatar of undefined
Last Comment

8/22/2022 - Mon

Can you provide a code snippet?

I think it may be a design problem. I need to figure out how to attach to the CStatic picture control that holds the bitmap I'm modifying. Seems to hang in the message pump.

Think about giving test-first design a try.  I would bet that you wouldn't have gotten stuck there if you had.  It forces you to take your programming step-by-step, but correctly the whole way.  It can also be fun.  Check it out.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

A request for deletion has been made.  If no response or you feel this is in error, comment.  If no objection, I will delete in three days.

E-E Admin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question