473,399 Members | 3,888 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,399 software developers and data experts.

Queue of Threads

Hi
What I want to do is for using with a PDA, but I think it's a VB.NET
related question, so I ask it here.
It's simple, an user is working with the pda, and from while to while,
has to send data to a server via webservice.
As the process to the webservice can take many seconds, and the user
has to continue working, I thought to send the process in a diferent
thread, and warn the user when it has finished. The problem is that the
user can send other process to the webservice while the first is still
running. What I'm interested is in creating a queue of threads, and
don't let execute the next thread until the previous has finished.
Also I'm not interested in treating this with only SyncLock to prevent
two threads to enter the same time to the process, because I want to
execute the threads in the order I throw them, and I think that with
this only prevention, the threads can execute in the order the computer
determines...
Any idea?

Thanks

Jan 25 '06 #1
3 4468
Jordi,

I like to use the Queue class with threads.

However you need in my opinion only one thread and let that access the queu.
You have than to synclock it, because your background worker is constantly
getting and cleaning the bottom of the queue, while your foreground worker
is filling that at the top (The representation from this text bottom top can
be visa versa what is not important).

http://msdn2.microsoft.com/en-us/lib...ons.queue.aspx

You can use more threads of course, however mostly is the result of that a
less easy to maintanance program while the result in throughput is than
almost nothing or even possible worse.

I hope this gives an idea,

Cor
Jan 25 '06 #2

Jordi Rico wrote:
Hi
What I want to do is for using with a PDA, but I think it's a VB.NET
related question, so I ask it here.
It's simple, an user is working with the pda, and from while to while,
has to send data to a server via webservice.
As the process to the webservice can take many seconds, and the user
has to continue working, I thought to send the process in a diferent
thread, and warn the user when it has finished.


It would probably be easier to use the built-in asynchronous way of
calling webservices - this handles the necessary background threading
for you. There's a topic in the help titled "Accessing an XML Web
Service Asynchronously in Managed Code" which should take you through
how to do this.

--
Larry Lard
Replies to group please

Jan 25 '06 #3
Thanks Cor,
I've implemented a class with a queue and an only thread as you
said,and some flags controling everything, and it works great!

Jan 25 '06 #4

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

Similar topics

4
by: Sachin Jagtap | last post by:
Hi, I am getting exception while poping item from queue, I am writing messages coming from client in a queue in one thread and then in other thread i am reading from queue and writing in file....
2
by: Rodrigo García | last post by:
Hi. The problem is a bit hard to explain. I have a ServicedComponent method which runs a distributed transaction consisting on a a MessageQueue reception and several database operations. That...
2
by: Hollywood | last post by:
I have a system in which I have a single thread that places data on a Queue. Then I have one worker thread that waits until data is put on the thread and dequeues the Queue and processes that...
0
by: Wavemaker | last post by:
One of the things I've struggled with from time to time is handling events raised on different threads. For example, an object could be listening to events from one or more objects running in...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
0
by: Dave Coate | last post by:
I am working on a generic way to launch multiple similar processes (threads) at once, but limit the number of threads running at any one time to a number I set. As I understand it the following...
4
by: Macca | last post by:
Hi, I've been reading the online documentation for the System.Collections.Queue object on how to implement a threadsafe Queue object. I understand the basics, by using the wrapper returned by...
12
by: Paul Rubin | last post by:
I'd like to suggest adding a new operation Queue.finish() This puts a special sentinel object on the queue. The sentinel travels through the queue like any other object, however, when...
19
by: =?ISO-8859-1?Q?Nordl=F6w?= | last post by:
I am currently designing a synchronized queue used to communicate between threads. Is the code given below a good solution? Am I using mutex lock/unlock more than needed? Are there any resources...
3
by: scriptlearner | last post by:
I am trying to put up a queue (through a logging thread) so that all worker threads can ask it to log messages. However, the problem I am facing is that, well, the logging thread itself is running...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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
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...
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.