473,787 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inter-thread communication to pass a job to another thread

Hi everyone,
We're developing an application to capture data from several serial
ports, store in a database, and (optionally) forward on using FTP.

Each serial port is being processed in a thread, so that capture of
data can continue if the UI is blocked with a modal dialg, for
example.

I would like each thread to be able to pass any FTP work to a
dedicated thread, so that its data capture is not interrupted if the
FTP takes a long time.

So what I'm looking at is:

main thread
--- capture thread A
--- capture thread B
--- ftp thread

The big question is: how do I pass the ftp data from threads A/B to
the FTP thread?

In a similar vein, am I going to have problems if thread A and thread
B are both writing to my MSDE database?

The other question, of course, is whether there's a better way to do
it!

Any pointers greatly appreciated!

Thanks,

James
Nov 20 '05 #1
2 1865
Hi James,

This seams a bit as Charles Law is busy with, however I get the idea you
have fixed the part of the serial port to the database as I understand your
question well. Maybe you can have a look at his problem in this newsgroup
and give him some advices.

In my opinion is the FTP is a File Transfer Protocol, so you can only send
file by file (that can be done in more threads) however in my idea that can
only be done when the file is complete.

In a message I gave Charles the idea to use a queue. The same idea I get
when I hear your problem. To Charles I said that a simple arraylist is very
suitable for his problem in my opinion. However for you problem I think that
can be even more. Putting in that queue the files which have to be
transfered can be a very simple sollution in combination with
multithreading.

When I do miss something, tell me what I miss?

Cor
Hi everyone,
We're developing an application to capture data from several serial
ports, store in a database, and (optionally) forward on using FTP.

Each serial port is being processed in a thread, so that capture of
data can continue if the UI is blocked with a modal dialg, for
example.

I would like each thread to be able to pass any FTP work to a
dedicated thread, so that its data capture is not interrupted if the
FTP takes a long time.

So what I'm looking at is:

main thread
--- capture thread A
--- capture thread B
--- ftp thread

The big question is: how do I pass the ftp data from threads A/B to
the FTP thread?

In a similar vein, am I going to have problems if thread A and thread
B are both writing to my MSDE database?

The other question, of course, is whether there's a better way to do
it!

Any pointers greatly appreciated!

Thanks,

James

Nov 20 '05 #2
Hi James

How about creating two classes: one which contains a (thread) method that
performs the data capture, and one that contains a method that performs ftp
work.

Create objects of these two classes and start the threads going from you UI
thread. Then you can carry on doing UI stuff.

When the data capture thread gets ftp work to be done, have it raise an
event that is handled in your UI thread. All the handler does is place the
work in a queue managed by the ftp thread, and pulses the queue object to
inform the ftp thread that something is ready. The UI thread then returns to
what it was doing.

If you don't want the UI thread to be bothered by any of this, you could
have a thread that just waits for events from data capture threads and
passes them to the ftp thread.

HTH

Charles
James Lavery wrote:
Hi everyone,
We're developing an application to capture data from several serial
ports, store in a database, and (optionally) forward on using FTP.

Each serial port is being processed in a thread, so that capture of
data can continue if the UI is blocked with a modal dialg, for
example.

I would like each thread to be able to pass any FTP work to a
dedicated thread, so that its data capture is not interrupted if the
FTP takes a long time.

So what I'm looking at is:

main thread
--- capture thread A
--- capture thread B
--- ftp thread

The big question is: how do I pass the ftp data from threads A/B to
the FTP thread?

In a similar vein, am I going to have problems if thread A and thread
B are both writing to my MSDE database?

The other question, of course, is whether there's a better way to do
it!

Any pointers greatly appreciated!

Thanks,

James

Nov 20 '05 #3

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

Similar topics

1
2938
by: Thierry Marneffe | last post by:
Hello Suppose a database Db1 with tables tl1 and tl2 and a second database db2 with tables tl3 et tl4. Is it possible to make a join between tables of the two databases ? As for example, Select * from tl1 INNER JOIN tl3 where tl1.Field1 = tl3.Field3
4
7975
by: TJ Olaes | last post by:
Hello all, this is my second post to this newsgroup. It's a question about stored procedures and permissions and how these behave between databases. Here's the scenario. I have a database that stores information for a system "A", and I have a different database on the same SQL server that stores the login and other info "LOGIN". I write a stored procedure in the "A" database that checks some tables in the "LOGIN" database, let's call...
1
1824
by: David M. Karr | last post by:
I've been asked to help debug a complex problem involving inter-frame references, so I just want to understand the elements involved with this. Apparently, there is a page with multiple frames, where one of the frames is a "hidden" frame, and is there just to contain one or more "fields" that are referenced from other frames. Supposedly, if a user "sits" somewhere in this set of pages for several minutes and then tries to do...
1
1187
by: VJ | last post by:
Hi.. Does anyone have a idea of how to integrate between C# and VB.. I have a project developed in VB.NET.. and a few other developers are doing additional screens in C#. How do I integrate the C# forms into VB? Vijay
2
1578
by: richard | last post by:
Hi, I am about to start developing an n-tier system. And was hoping to get an insight into the best ways of doing this. Inparticular, I want to know how I can develop classes/component to be deployed on different servers which will interact with eachother. What is the best mode of interaction? i.e. remoting or web services or other? If I go ahead and deploy the layers on separate servers am I right in thinking that scalability will...
13
4150
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make sense to punch out from managed code to native code (I was using IJW) in order to do some amount of floating point work and, if so, what that certain amount of floating point work was approximately. To attempt to do this I made a program that...
1
4967
by: Laurence | last post by:
Hi folks, As I konw: database partition (aka data partition?), the database can span multiple machines; table partition, the data within a table can seperate by certain condition. How about inter-partition and intra-partition? Is inter-partition database partition...?
0
1490
by: rkprasad | last post by:
I am able to create BASIC-CLEAR-INTEGRATED sql http endpoint and consume it on a LAN. But i am not able to consume the created endpoint on inter domain network. If i create endpoint on a server having live IP and try to access it as http://59.165.20.29/SqlHttpEndPointPath?WSDL from a LAN which has its own proxy then I am not able to access it ; and get HTTP 500/HTTP 501 error in the browser. In a different way i create an sql http endpoint...
1
2214
by: rsennat | last post by:
Hi, what is the order of the libraries in the Makefile, for linking inter dependent libraries. i'm getting linker error for the following scenario. I have lib1.a and lib2.a, with which lib1.a needs lib2.a and lib2.a needs lib1.a for linking. How can this be resolved. any thoughts on this would be helpful. thanks rsennat
0
1297
by: Rakeshashapur | last post by:
hi, i'm using grid view in vs 2008. i want to inter chang the columns by drag and drop.(similary to reordered list extender of Ajax control tool kit). please any one explain me how to do this. (if posible give me a example code) thank you.....
0
9655
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
9498
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
10172
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
10110
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,...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
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
5398
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
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.