473,395 Members | 1,464 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,395 software developers and data experts.

Do threads behave Differently on Windows 98?

Hi,

Sorry for the cross group post, but I couldn't find a group that deals with
threading in .net.

Anyway, I've noticed a difference in the way my program acts on Windows 98
than it does on WindowsXP and was wondering if anybody can explain this
behaviour.

My application runs in the background to collect data through the serial
port using a 3rd party ActiveX communications control (not MSComm). The
control is single threaded and needs a form to be hosted on. I call the
"Read" method on the control to read data and the result is returned
Asynchronously in an event called "OnReadDone".

I host the control on a hidden form that is created on an STA thread. When I
want to read data, I invoke the "ReadSync" method on the form (which I have
created to convert the Asynchronous "Read" call to a synchronous call). I
use a ManualResetEvent in the "ReadSync" method to block the thread until
the result is returned by the event.

In Windows XP, everything works fine - the "ReadSync" method blocks, the
event fires, and then the "ReadSync" method returns.

In Windows 98, the event doesn't fire until the wait on the ManualResetEvent
times out and unblocks the form's thread.

I've fixed the problem by not ever blocking the form's thread - by moving
the "ReadSync" method into the thread that invokes the "Read" method and
waiting there.

Is this behaviour by design and is Windows XP letting me do things I
shouldn't be, or is it a shortcoming in the way threads are handled under
Windows 98? Could it be something to do with the COM interop side of things
with the ActiveX control?

I'm using Visual Studio 2003 and Framework 1.1 on both machines.

I'd appreciate any thoughts on this.

Best Regards,

Trev.
Jul 21 '05 #1
1 1589
Hi,
Thanks for you post.
I have posted my reply in the windowsforms group. I'll close this thread
and follow-up with you in that thread.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

--------------------
| From: "Codemonkey" <hu*********@hotmail.com>
| Subject: Do threads behave Differently on Windows 98?
| Date: Wed, 29 Oct 2003 16:46:41 -0000
| Lines: 45
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uT**************@tk2msftngp13.phx.gbl>
| Newsgroups:
microsoft.public.dotnet.faqs,microsoft.public.dotn et.framework.interop,micro
soft.public.dotnet.framework.windowsforms,microsof t.public.dotnet.general
| NNTP-Posting-Host: prtn-3e352849.pool.mediaways.net 62.53.40.73
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.interop:20000
microsoft.public.dotnet.framework.windowsforms:554 47
microsoft.public.dotnet.general:113579 microsoft.public.dotnet.faqs:12218
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Hi,
|
| Sorry for the cross group post, but I couldn't find a group that deals
with
| threading in .net.
|
| Anyway, I've noticed a difference in the way my program acts on Windows 98
| than it does on WindowsXP and was wondering if anybody can explain this
| behaviour.
|
| My application runs in the background to collect data through the serial
| port using a 3rd party ActiveX communications control (not MSComm). The
| control is single threaded and needs a form to be hosted on. I call the
| "Read" method on the control to read data and the result is returned
| Asynchronously in an event called "OnReadDone".
|
| I host the control on a hidden form that is created on an STA thread.
When I
| want to read data, I invoke the "ReadSync" method on the form (which I
have
| created to convert the Asynchronous "Read" call to a synchronous call). I
| use a ManualResetEvent in the "ReadSync" method to block the thread until
| the result is returned by the event.
|
| In Windows XP, everything works fine - the "ReadSync" method blocks, the
| event fires, and then the "ReadSync" method returns.
|
| In Windows 98, the event doesn't fire until the wait on the
ManualResetEvent
| times out and unblocks the form's thread.
|
| I've fixed the problem by not ever blocking the form's thread - by moving
| the "ReadSync" method into the thread that invokes the "Read" method and
| waiting there.
|
| Is this behaviour by design and is Windows XP letting me do things I
| shouldn't be, or is it a shortcoming in the way threads are handled under
| Windows 98? Could it be something to do with the COM interop side of
things
| with the ActiveX control?
|
| I'm using Visual Studio 2003 and Framework 1.1 on both machines.
|
| I'd appreciate any thoughts on this.
|
| Best Regards,
|
| Trev.
|
|
|

Jul 21 '05 #2

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

Similar topics

31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
6
by: kracchh | last post by:
Hi, the following .NET 1.1 C#-program does not terminate (opposed to what I would expect): -------- using System; using System.Threading; public class Test {
8
by: Angel | last post by:
Hi everybody, I am new to ASP.NET, and my question might be obvious to most of you but I do not seem to find many things about threads and ASP.NET. I have an object(Object 1) which need some...
1
by: Codemonkey | last post by:
Hi, Sorry for the cross group post, but I couldn't find a group that deals with threading in .net. Anyway, I've noticed a difference in the way my program acts on Windows 98 than it does on...
1
by: Mike Mascari | last post by:
This is a really trivial question, but I'm curious. Why do subselects in target lists behave differently than simple queries? Ex: create temporary table bar (key varchar(32) not null);...
3
by: Object01 | last post by:
I wanted to prove a concept, so wrote a page that does the following: public void btn_click() { File.CreateText("file.txt"); Response.BufferOutput = false;...
10
by: S James S Stapleton | last post by:
Is volatile necessary anymore? I have a two-thread piece of code I've been testing to figure out what volatile does (fairly simple code, uses pthreads). I have an update thread (variables passed as...
0
by: jeremyje | last post by:
I would like to create an application where I have many concurrent processes being managed by a monitoring process. Each process that is "managed" will be invoked from an assembly dll (think...
0
by: Gabriel Genellina | last post by:
En Thu, 02 Oct 2008 10:17:01 -0300, <dudeja.rajat@gmail.comescribió: For myDll_GetVersion you should define its arguments and return type using ..argtypes and .restype - else ctypes assumes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.