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

polling versus event driven...

hey guys.

overview
---------
I'm designing a messaging system that works on the principle of late binding
to the I/O objects, depending on the .Net class libraries present in the
local folder.

I may have an output File.DLL, and ODBC.DLL, that instantiate an abstract
parent to stream data i receive... an input .DLL allows data to be streamed
in.

The application is currently designed to be multithreaded, so that five
input channels maybe monitor at once, and data coming in can be processes
asynchronously.
the problem
------------

The problem I'm having is with the input, where I've got some DLL's, and
messages coming in...
i can either have a polling mechanism (currently instantiated), where each
monitoring thread checks for data, if none exists, then wait some amount of
time before checking again.
i've been asked to look at the other option, setting up an event delegate
system so that when a message arrives on a channel, the thread monitoring
that channel fires an event causing the data to be processed.

I don't see how this event driven mechanism would really benefit, as it
seems all thats happening is the polling (i.e., check for message, if none,
wait for a bit, try again) mechanism is no longer shared between my server
and it's I/O plugin DLL's, but rather placed entirely inside the
application.

does c# use the same thread when an event is called?
am I missing the idea behind events?
are there other alternatives / approaches to this situation?

thanks for your time.
Dan.

Nov 15 '05 #1
1 3391
Hey Daniel,
does c# use the same thread when an event is called?
Yes, the event handler will be run on the same thread the event has been
raised
are there other alternatives / approaches to this situation?
In general, it is always better to use synchronization objects such as
events or mutexes than to poll. I would suggest your plug-ins should use
synchronization objects to notify the listening thread of data available in
the channel being monitored.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Daniel Bass" <I'm really @ sick of spam> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl... hey guys.

overview
---------
I'm designing a messaging system that works on the principle of late binding to the I/O objects, depending on the .Net class libraries present in the
local folder.

I may have an output File.DLL, and ODBC.DLL, that instantiate an abstract
parent to stream data i receive... an input .DLL allows data to be streamed in.

The application is currently designed to be multithreaded, so that five
input channels maybe monitor at once, and data coming in can be processes
asynchronously.
the problem
------------

The problem I'm having is with the input, where I've got some DLL's, and
messages coming in...
i can either have a polling mechanism (currently instantiated), where each
monitoring thread checks for data, if none exists, then wait some amount of time before checking again.
i've been asked to look at the other option, setting up an event delegate
system so that when a message arrives on a channel, the thread monitoring
that channel fires an event causing the data to be processed.

I don't see how this event driven mechanism would really benefit, as it
seems all thats happening is the polling (i.e., check for message, if none, wait for a bit, try again) mechanism is no longer shared between my server
and it's I/O plugin DLL's, but rather placed entirely inside the
application.

does c# use the same thread when an event is called?
am I missing the idea behind events?
are there other alternatives / approaches to this situation?

thanks for your time.
Dan.


Nov 15 '05 #2

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

Similar topics

2
by: alanrn | last post by:
For all you seasoned VB programmers this is going to be a no brainer. However, as a C programmer learning VB I'm having trouble getting my arms around the event-driven nature of VB. Suppose I...
2
by: Dennis Ålund | last post by:
Is it possible to notice a change of window.location.hash without polling? I'm working on a Ajax-platform (yes, inventing the wheel again) and have finished almost everything except the support...
14
by: Snor | last post by:
I'm attempting to create a lobby & game server for a multiplayer game, and have hit a problem early on with the server design. I am stuck between using a threaded server, and using an event driven...
4
by: AzizMandar | last post by:
C++ Event Coding Questions I have done some simple programs in C++ and read a lot of good C++ books (Including The C++ Programing Language, and C++ Primer) I am trying to understand and...
13
by: LordHog | last post by:
Hello all, I have a little application that needs to poll a device (CAN communications) every 10 to 15 ms otherwise the hardware buffer might overflow when there are message burst on the bus. I...
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
4
by: sid | last post by:
Can someone tell me how to detect "Action Cancelled" page with out polling. I have a frame set and I want to make sure the other frame is displaying what it is supposed to without polling. For...
0
MMcCarthy
by: MMcCarthy | last post by:
VBA is described as an Event driven programming language. What is meant by this? Access, like most Windows programs, is an event driven application. This means that nothing happens unless it is...
15
by: Phillip B Oldham | last post by:
Are there any python event driven frameworks other than twisted?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.