|
-
July 24th, 2012, 04:44 PM
#1
How do I solve this problem without a continuous loop
Hello everyone,
I'm developing a project where I have a managing application with two tcplisteners, and i have 2 types of clients connecting to this application. The purpose is that the type1 client sends a task to the central application and then that application sends the message to the type2 client so it executes that task, this message is only sent if there are type2 clients available (not executing a task already), otherwise they stay in queue.
I've thought of using a queue to achieve this, but the problem is, some tasks can't be started without the previous task being completed, also, the tasks and different priority levels.
Maybe I'm not being clear what i mean is the following:
task1 is sent with priority level 2.
task2 is sent with priority level 2 and depends on task1 to be complete.
task3 is sent with priority level 1.
Imagining the task1 is still being executed on client1 and there is a client available to process tasks, how would I code it so the central application starts the task3 keeping the task2 in queue?
I could keep a continuous loop reading all records from the task queue but obviously that would burn all the computer resources.
Also keep in mind that the task queue can have periods without any records.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|