473,396 Members | 2,033 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,396 software developers and data experts.

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 1828
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
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,...
4
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...
1
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,...
1
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...
2
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...
13
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...
1
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...
0
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...
1
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...
0
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...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.