473,769 Members | 5,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Thread A notifying Thread B of an Event

Using VS 2003, VB, MSDE...

There are two threads, A & B, that continously run and are started by Sub
Main. They instantiationsl of identical code. Thread A handles call
activity on telephone line 1 and Thread B handles call activity on telephone
line 2. They use a common SQL datasource, but all DataSets are unique to
each thread.

Is there a way for thread A to occasionally communication to thread B that
something has happened? The ideal situation would be for thread A to raise
an event that a handler in thread B handles. But, I don't see how to do
that (the raised event would be handled "up the call stack" in Sub Main, not
"horizontia lly" by the other thread).

Specifically, thread A has added a row(s) to the common datasource that I
need thread B to know about. I am currently doing it with a timer in thread
B that check the common datasource for changes every 15 seconds, which works
OK, but am looking for a simpler solution. I have looked at SQL triggers,
but don't see how that would alert thread B. I have looked at RaseEvents,
but don't see any help there either.

Any ideas? Do System.Timers. exert a heavy resource usage toll? If not I
may jus stick with the timer method.

Thansk!

Bob
Nov 20 '05
20 2417
Cor
Hi David,

Thanks for your answer,

What I did try to show in this thread is (the problem is not important
anymore) that there is chosen for a thread solution instead of a remoting
solution. There is a Main process, which starts two threads.

With "horizontal " solutions, I mean that the managing of the solution is not
ordered by a higher vertical level but done on the same process level.

However, it is worse, the solution is:
Main
- B
- A
B is doing the control part using timers, (I said before those timers is not
the most important of the bad design).

The solution could have been remoting (and than I agree, with all what you
say)
A B with control to each other

Or multithreading
Main (with control over A and B)
A B

What you said about what I should have said about the data process approach
I never said, in both situations it is in my opinion that the best (the
only) choose to use separated data, it would otherwise kill it self in
concurrency problems.

I hope this makes it clearer.

Cor


Nov 20 '05 #21

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

Similar topics

26
2380
by: news.microsoft.com | last post by:
Hi, Currently I have a thread thats spinning and doing a Thread.Sleep(someTime). I was thinking of changing this to Thread.Sleep(Timeout.Infinite); then when I have actual data in a collection to process in this thread, I was going to do a _thread.Interrupt(); Would this be a better approach to spinning a thread on ?
1
4475
by: benmorganpowell | last post by:
I have a small windows service which connects to a POP3 server at defined intervals, scans the available messages, extracts the required information and inserts the data into a SQL database. I am assuming that this is not an uncommon piece of software. I want to get an architecture that conforms as closely as possible with the recommendations from Microsoft on developing Windows Services, but to be honest I have found difficultly in...
2
2068
by: Bob Day | last post by:
Using VS 2003, Vb, MSDE... Option 1 ------------------------------------------- Thread A and B are instantiations of 2 different classes. If thread A raises an event caught by thread B, the delagate in thread B that executes is 1) running under thread A based on the debug threading window and 2) does not seem to be aware of any instantiations of thread B in its declarations section. See **** for what fails. Class B (which is thread...
7
2695
by: Charles Law | last post by:
My first thought was to call WorkerThread.Suspend but the help cautions against this (for good reason) because the caller has no control over where the thread actually stops, and it might have a lock pending, for example. I want to be able to stop a thread temporarily, and then optionally resume it or stop it for good.
2
4148
by: Tim | last post by:
The are 2 threads - main thread and worker thread. The main thread creates the worker thread and then the worker thread runs in an infinite while loop till it is asked to exit by setting an event. The worker thread instantiates an object and calls methods of that object. If some method call fails, the main thread needs to be notified about the failure. What mechanisms exist for notifying the main thread about the worker thread's status -...
9
1116
by: Tim | last post by:
if I start a thread mythread.start and then I click a button that has a do loop with no doevents in the loop, do loop until myval=true
11
1954
by: mark | last post by:
Right now I have a thread that sleeps for sometime and check if an event has happened and go back to sleep. Now instead I want the thread to sleep until the event has occured process the event and go back to sleep. How to do this? thanks mark class eventhndler(threading.Thread): def __init__(self):
18
2542
by: J.K. Baltzersen | last post by:
To whomever it may concern: I am using MS Visual C++ 6.0. I have a process A which instantiates an object C. At a later point the process A creates the thread B. The thread B has access to the object C.
0
9587
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
9423
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
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
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...
1
9993
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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
5298
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.