Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

possible thread deadlock on printf?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jun - 09 Jul 2005 15:34 GMT
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
Jun - 09 Jul 2005 21:58 GMT
> hi,
>
[quoted text clipped - 13 lines]
>
> -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
Carl Daniel [VC++ MVP] - 09 Jul 2005 22:48 GMT
>> hi,
>>
[quoted text clipped - 39 lines]
>
> any idea?

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

-cd
Jun - 10 Jul 2005 05:19 GMT
>>> hi,
>>>
[quoted text clipped - 43 lines]
>
> -cd

hi,

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

-jun
Carl Daniel [VC++ MVP] - 10 Jul 2005 06:03 GMT
> "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
Jun - 10 Jul 2005 06:48 GMT
>> "Carl Daniel [VC++ MVP]"
>>>
[quoted text clipped - 6 lines]
>
> -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
Jun - 10 Jul 2005 07:30 GMT
>> "Carl Daniel [VC++ MVP]"
>>>
[quoted text clipped - 6 lines]
>
> -cd

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

try to post if anythings comes up

thanks a lot
-jun

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.