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 / .NET Framework / Distributed Applications / March 2005

Tip: Looking for answers? Try searching our database.

Threads freezes other application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jesse - 03 Mar 2005 14:52 GMT
I have a C# application that runs fine on any computer (XP,
2000, 98). I have just installed on a PC that also has a
POS which runs in kiosk mode. The problem is that when my
application start running the POS stop responding (or at
least stop repainting screens). My application is a console
application which starts 2 different threads.  I debugged
my application and found out that on thread #1 the line of
code affecting the POS is a Thread.Sleep(x); on thread #2
the line is a Monitor.Wait(x).  

If I remove those lines from code the POS works fine, but
my application will not work as intended.

I'm suspicious of the [STAThread] attribute on the Main
function.

I will appreciate any kind of help.
richlm - 03 Mar 2005 22:11 GMT
Is there a resource (e.g. a file, a socket, ...) which both applications
want to own - but only one of them can (e.g. only 1 can have write access to
a file). Pinpointing this resource could be the key to solving your problem.

The STAThread attribute affects COM interop within the process. If your
application uses COM objects, your could try changing the attribute to
MTAThread. If you do this, your COM object(s) MUST be threadsafe. Look up KB
150777 for a complete description of STA/MTA.

Hope that helps.
Richard.
Jesse - 03 Mar 2005 23:29 GMT
There is no relation between my app and the POS, they dont share any
resouces. I was googling and came to my mind that may be could be the an
issues of thread priorities. May be my app threads blocks the POS paint
thread, but may be Im wrong...what do you think?

By the way, my application never stop responding, it smoothly without
problems. Also, no other application on the computer misbehaves except for
the POS.

> Is there a resource (e.g. a file, a socket, ...) which both applications
> want to own - but only one of them can (e.g. only 1 can have write access to
[quoted text clipped - 7 lines]
> Hope that helps.
> Richard.
richlm - 08 Mar 2005 17:59 GMT
The only shared resource then could be the CPU - is your application
utilizing it heavily and the POS have low priority?

You could try some of the tools available for free download from
www.sysinternals.com (e.g. process explorer) - it may help to give a clearer
picture of what's going on in each of the 2 applications.
Geert Depickere - 25 Mar 2005 11:00 GMT
Hi Jesse,

I vagely remember having a simular problem (two unlated applications
influencing each other).

The app. causing the problem cantained a WaitForMultipleObjects Win32 call.
I had to replace it by a MsgWaitForMultipleObjects to solve the problem.

The difference between both calls is that the second one still processes
Windows messages (WM_xxx) while waiting (the first one does not).  If I
remember well, the program influenced by this was an old program and it was
periodically sending broadcase messages to all other open windows and
waiting for their reply, something todo with very old Windows (3.11?)
requirements...

Hope this helps

Geert D.

> I have a C# application that runs fine on any computer (XP,
> 2000, 98). I have just installed on a PC that also has a
[quoted text clipped - 13 lines]
>
> I will appreciate any kind of help.

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.