473,698 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Event handling + thread handling.

I've written an event that tells me that I've connected properly to a
remote telnet location. When I know that I'm connected I fire the event
which is being listened for in a bit of code that then goes on and does
some work based on this event.

My problem is that once I fire that event, the thread that fired it
waits until the thread that received it finishes. I fixed the problem
by making the bit of code that is listening for the event continue on
with what it is doing in the background, but I'm wondering if there is a
different way.

Specifically, the code is going through a csv file and then doing a few
things on a remote system to get information based on something in the
csv, and then processing that information once we get it.

Everything works fine, but I'd like to know what I'm doing wrong, in
that I don't think that the thread should be tied up waiting for
whatever was listening for the event to finish.

Any help, or pointing in the right direction is as usual, very much
appreciated.

regards,
M.
Nov 17 '05 #1
1 1574
Hmmm. I was working on events on my screensaver, and I utilize events and I
noticed that the program output mentions that a separate thread that handles
events. I think it called it the NetEvent thread, which confirmed my
suspicion that events are handled on a separate thread.

My suggestion is to create a worker thread to start the event running, and
then when it is done, have the thread end.

"Michael McCarthy" <no********@nom ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I've written an event that tells me that I've connected properly to a
remote telnet location. When I know that I'm connected I fire the event
which is being listened for in a bit of code that then goes on and does
some work based on this event.

My problem is that once I fire that event, the thread that fired it waits
until the thread that received it finishes. I fixed the problem by making
the bit of code that is listening for the event continue on with what it
is doing in the background, but I'm wondering if there is a different way.

Specifically, the code is going through a csv file and then doing a few
things on a remote system to get information based on something in the
csv, and then processing that information once we get it.

Everything works fine, but I'd like to know what I'm doing wrong, in that
I don't think that the thread should be tied up waiting for whatever was
listening for the event to finish.

Any help, or pointing in the right direction is as usual, very much
appreciated.

regards,
M.

Nov 17 '05 #2

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

Similar topics

8
6084
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that uses message queues to pass pointers to Events between threads. In my app there are simple events that can be defined using an enum (for example an event called NETWORK_TIMEOUT) and more complex events that contain data (for example an event called...
4
6588
by: NutJob | last post by:
Hello, I'm faced with the following problem: I have a (secondary) thread that monitors a socket for incoming message traffic using the select.select() function. Besides that I also have the main thread of my WxPython application. So far so good. Now when my socket thread detects an incoming message, I need my main
1
2639
by: Beren | last post by:
Hello With trial and error I'm attempting to create an extended identity to store some more data than just the Name, for example a Subscription and a LastSearchPerformed property... Is this a good idea ? I'm coming from ASP and Session variables, but I explicitly wanted to avoid that for .NET. The problem I'm facing is that I don't find a good way to bring my source
2
2134
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the database. This works fine. However, I attempt to notify the user when data accesses occur. The way I attempt to accomplish this is by changing the background color of a label on the form the user is looking at. I use red for when the database is...
10
3271
by: Jon | last post by:
I'm investiging multi-threaded GUI applications; specifically the technique used to ensure that controls are only modified under the correct thread. The standard technique is to use if(InvokeRequired == true) ... BeginInvoke(...) ... I have some code that ensures that an event fired from a worker (non-GUI) thread will use the appropriate BeginInvoke call for synchronisation. By offloading the synchronisation onto the worker thread the...
1
4139
by: David Herbst | last post by:
Enterprise Library Jan 2006 with Visual Studio 2005 on Windows 2000 Server sp4. My custom exception formatter fails with a "Unable to handle exception: 'LoggingExceptionHandler'." exception. When I attached the debugger to the process and stepped into the code it executed without error. In both cases I was running a Debug build, the only difference in the case that works is that I attached the debugger to the same exact binaries....
4
2847
by: Jimmy | last post by:
hi, all I'm having a problem with creating custom events in wxpython. I have a class A handling some data processing work and another class B of GUI matter. I need GUI to display information when data in A is updated. I know cutom events in wxpython may work. But I found no material paricularly helpful :(
2
19474
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.