473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

possible thread deadlock on printf?

Jun
hi,

deadlock on printf?
server testing.exe!printf(const char * format=0x000007b4, ...) Line 65 +
0x1d C


but i only have 2 running threads at console app... i have no idea printf()
does deadlock.
it always shows after few min of testing...

any ideas? suggestions? or is there something i missed? (or rewrite in win
app? :-S)

thanks in advance.

-jun
Nov 17 '05 #1
12 1912
Jun

"Jun" <j_******@yahoo.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl...
hi,

deadlock on printf?
server testing.exe!printf(const char * format=0x000007b4, ...) Line 65 +
0x1d C


but i only have 2 running threads at console app... i have no idea
printf() does deadlock.
it always shows after few min of testing...

any ideas? suggestions? or is there something i missed? (or rewrite in win
app? :-S)

thanks in advance.

-jun


hi,

just found out that it deadlocks on creating mutex

code...
....
printf(" ProcessReply() mutex created\n");
MutexLock _lock(g_chLock);
printf(" ProcessReply() lock started\n");
....
printf(" ProcessReply() mutex destroy\n");

and this is how i found out
....
ThreadDatabase() mutex created
ThreadDatabase() lock started
....
ThreadDatabase() mutex destroy

ProcessReply() mutex created
STUCKED HERE!

i even tried criticalsection at first, still same :(

any idea?

thanks
-jun
Nov 17 '05 #2
Jun

"Jun" <j_******@yahoo.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl...
hi,

deadlock on printf?
server testing.exe!printf(const char * format=0x000007b4, ...) Line 65 +
0x1d C


but i only have 2 running threads at console app... i have no idea
printf() does deadlock.
it always shows after few min of testing...

any ideas? suggestions? or is there something i missed? (or rewrite in win
app? :-S)

thanks in advance.

-jun


hi,

just found out that it deadlocks on creating mutex

code...
....
printf(" ProcessReply() mutex created\n");
MutexLock _lock(g_chLock);
printf(" ProcessReply() lock started\n");
....
printf(" ProcessReply() mutex destroy\n");

and this is how i found out
....
ThreadDatabase() mutex created
ThreadDatabase() lock started
....
ThreadDatabase() mutex destroy

ProcessReply() mutex created
STUCKED HERE!

i even tried criticalsection at first, still same :(

any idea?

thanks
-jun
Nov 17 '05 #3
Jun wrote:
"Jun" <j_******@yahoo.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl...
hi,

deadlock on printf?
server testing.exe!printf(const char * format=0x000007b4, ...) Line 65 +
0x1d C


but i only have 2 running threads at console app... i have no idea
printf() does deadlock.
it always shows after few min of testing...

any ideas? suggestions? or is there something i missed? (or rewrite
in win app? :-S)

thanks in advance.

-jun


hi,

just found out that it deadlocks on creating mutex

code...
...
printf(" ProcessReply() mutex created\n");
MutexLock _lock(g_chLock);
printf(" ProcessReply() lock started\n");
...
printf(" ProcessReply() mutex destroy\n");

and this is how i found out
...
ThreadDatabase() mutex created
ThreadDatabase() lock started
...
ThreadDatabase() mutex destroy

ProcessReply() mutex created
STUCKED HERE!

i even tried criticalsection at first, still same :(

any idea?


Show more code. What is the complete definition of MutexLock?

-cd
Nov 17 '05 #4
Jun wrote:
"Jun" <j_******@yahoo.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl...
hi,

deadlock on printf?
server testing.exe!printf(const char * format=0x000007b4, ...) Line 65 +
0x1d C


but i only have 2 running threads at console app... i have no idea
printf() does deadlock.
it always shows after few min of testing...

any ideas? suggestions? or is there something i missed? (or rewrite
in win app? :-S)

thanks in advance.

-jun


hi,

just found out that it deadlocks on creating mutex

code...
...
printf(" ProcessReply() mutex created\n");
MutexLock _lock(g_chLock);
printf(" ProcessReply() lock started\n");
...
printf(" ProcessReply() mutex destroy\n");

and this is how i found out
...
ThreadDatabase() mutex created
ThreadDatabase() lock started
...
ThreadDatabase() mutex destroy

ProcessReply() mutex created
STUCKED HERE!

i even tried criticalsection at first, still same :(

any idea?


Show more code. What is the complete definition of MutexLock?

-cd
Nov 17 '05 #5
Jun

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Jun wrote:
"Jun" <j_******@yahoo.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl...
hi,

deadlock on printf?

server testing.exe!printf(const char * format=0x000007b4, ...) Line 65
+ 0x1d C

but i only have 2 running threads at console app... i have no idea
printf() does deadlock.
it always shows after few min of testing...

any ideas? suggestions? or is there something i missed? (or rewrite
in win app? :-S)

thanks in advance.

-jun


hi,

just found out that it deadlocks on creating mutex

code...
...
printf(" ProcessReply() mutex created\n");
MutexLock _lock(g_chLock);
printf(" ProcessReply() lock started\n");
...
printf(" ProcessReply() mutex destroy\n");

and this is how i found out
...
ThreadDatabase() mutex created
ThreadDatabase() lock started
...
ThreadDatabase() mutex destroy

ProcessReply() mutex created
STUCKED HERE!

i even tried criticalsection at first, still same :(

any idea?


Show more code. What is the complete definition of MutexLock?

-cd


hi,

i'm using the http://www.bbdsoft.com/win32.html

-jun
Nov 17 '05 #6
Jun

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Jun wrote:
"Jun" <j_******@yahoo.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl...
hi,

deadlock on printf?

server testing.exe!printf(const char * format=0x000007b4, ...) Line 65
+ 0x1d C

but i only have 2 running threads at console app... i have no idea
printf() does deadlock.
it always shows after few min of testing...

any ideas? suggestions? or is there something i missed? (or rewrite
in win app? :-S)

thanks in advance.

-jun


hi,

just found out that it deadlocks on creating mutex

code...
...
printf(" ProcessReply() mutex created\n");
MutexLock _lock(g_chLock);
printf(" ProcessReply() lock started\n");
...
printf(" ProcessReply() mutex destroy\n");

and this is how i found out
...
ThreadDatabase() mutex created
ThreadDatabase() lock started
...
ThreadDatabase() mutex destroy

ProcessReply() mutex created
STUCKED HERE!

i even tried criticalsection at first, still same :(

any idea?


Show more code. What is the complete definition of MutexLock?

-cd


hi,

i'm using the http://www.bbdsoft.com/win32.html

-jun
Nov 17 '05 #7
Jun wrote:
"Carl Daniel [VC++ MVP]"

Show more code. What is the complete definition of MutexLock?


i'm using the http://www.bbdsoft.com/win32.html


OK, fine. Those classes look straightforward and correct. How 'bout showing
a bit more of your code now?

-cd
Nov 17 '05 #8
Jun wrote:
"Carl Daniel [VC++ MVP]"

Show more code. What is the complete definition of MutexLock?


i'm using the http://www.bbdsoft.com/win32.html


OK, fine. Those classes look straightforward and correct. How 'bout showing
a bit more of your code now?

-cd
Nov 17 '05 #9
Jun

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:Od****************@TK2MSFTNGP10.phx.gbl...
Jun wrote:
"Carl Daniel [VC++ MVP]"

Show more code. What is the complete definition of MutexLock?


i'm using the http://www.bbdsoft.com/win32.html


OK, fine. Those classes look straightforward and correct. How 'bout
showing a bit more of your code now?

-cd


oh ok, the code kinda bit bloated, here is the basic...

if (true)
{
CriticalLock _lock(g_chLock);
std::map<int, tPlayerInfo>::iterator _iterPlayerInfo =
m_mPlayerInfo.begin();
while(_iterPlayerInfo != m_mPlayerInfo.end())
{
...
++_iterPlayerInfo;
}
}

program runs only 2 threads... main() doesn't do anything just to input a
string.
i'm just protecting the m_mPlayerInfo from sharing...

hope this helps, probably any good tool to detect deadlock?

thanks
-jun
Nov 17 '05 #10
Jun

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:Od****************@TK2MSFTNGP10.phx.gbl...
Jun wrote:
"Carl Daniel [VC++ MVP]"

Show more code. What is the complete definition of MutexLock?


i'm using the http://www.bbdsoft.com/win32.html


OK, fine. Those classes look straightforward and correct. How 'bout
showing a bit more of your code now?

-cd


oh ok, the code kinda bit bloated, here is the basic...

if (true)
{
CriticalLock _lock(g_chLock);
std::map<int, tPlayerInfo>::iterator _iterPlayerInfo =
m_mPlayerInfo.begin();
while(_iterPlayerInfo != m_mPlayerInfo.end())
{
...
++_iterPlayerInfo;
}
}

program runs only 2 threads... main() doesn't do anything just to input a
string.
i'm just protecting the m_mPlayerInfo from sharing...

hope this helps, probably any good tool to detect deadlock?

thanks
-jun
Nov 17 '05 #11
Jun

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:Od****************@TK2MSFTNGP10.phx.gbl...
Jun wrote:
"Carl Daniel [VC++ MVP]"

Show more code. What is the complete definition of MutexLock?


i'm using the http://www.bbdsoft.com/win32.html


OK, fine. Those classes look straightforward and correct. How 'bout
showing a bit more of your code now?

-cd


sorry, i think it has something to do with memory leaks :-(

try to post if anythings comes up

thanks a lot
-jun
Nov 17 '05 #12
Jun

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:Od****************@TK2MSFTNGP10.phx.gbl...
Jun wrote:
"Carl Daniel [VC++ MVP]"

Show more code. What is the complete definition of MutexLock?


i'm using the http://www.bbdsoft.com/win32.html


OK, fine. Those classes look straightforward and correct. How 'bout
showing a bit more of your code now?

-cd


sorry, i think it has something to do with memory leaks :-(

try to post if anythings comes up

thanks a lot
-jun
Nov 17 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: phil | last post by:
And sorry I got ticked, frustrating week >And I could help more, being fairly experienced with >threading issues and race conditions and such, but >as I tried to indicate in the first place,...
8
by: mk | last post by:
You probably suspect the answer, typically its 'yes' deadlock can occur in any multithreaded application. Even ones that employ static members. Commonly it occurs when more than one thread tries...
0
by: Jun | last post by:
hi, deadlock on printf? > server testing.exe!printf(const char * format=0x000007b4, ...) Line 65 + > 0x1d C but i only have 2 running threads at console app... i have no idea printf()...
6
by: Robert Speck | last post by:
Hi there, Can anyone shed anymore light on why "Thread.Suspend()" has been deprecated by MSFT beyond what MSDN says about it. I'm not sure if I quite appreciate the various pitfalls they discuss...
6
by: Zytan | last post by:
I have code running in the debugger as I type. I press pause, and it pauses on: Application.Run(new myForm()); *I believe* a worker thread is in deadlock (it's in a lock, but calls another...
2
by: Amit Dedhia | last post by:
Hi I am developing a scientific application which has moderate level image processing involved. In my application, there is a main application form which invokes another form. When this form...
20
by: cty0000 | last post by:
I have some question.. This is my first time to use thread.. Following code does not have error but two warring The warring is Warning 2 'System.Threading.Thread.Suspend()' is obsolete:...
2
by: Maqsood Ahmed | last post by:
Hello, I asked a question regarding thread synchronization on this usergroup some days back. I was using the AutoResetEvent class for signalling between two threads. The problem with...
34
by: Creativ | last post by:
Why does Thread class not support IDisposable? It's creating quite some problem. Namely, it can exhaust the resource and you have not control over it.
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.