Jump to content
|Topic||Stats||Last action by|
|Windows users: Are you going to upgrade to Windows 10 after its release?||
|Old Calculator for Windows 10 from Windows 7 or Windows 8||
|Looking for Server/Comp Status Monitor for IOS||
|7 Days: A week of Apple riches, Microsoft's future, OnePlus 2, and the love of a low-end Lumia||
|Windows 10 Build 9926 0xC1900101-0x40017 Install Error||
Posted 31 January 2013 - 10:39
Posted 31 January 2013 - 10:44
Posted 31 January 2013 - 10:48
Switching to threading would require re-debugging a lot of the code, and I thought using the thread pool of tasks would be better, as I could have tens or potentially hundreds of tasks running, most of which are not taking much cpu, but are either idle or doing network transfers.
Why aren't you threading the multiple tasks?
That would appear to grant greater performance and would fix the issue you're facing now O.o
Making the change would be extremely simple to do. .net is really built for multi-threading with ease.
Failing that, check out the Async and Await keywords added in .net 5, but honestly, threading is a better answer.
Posted 01 February 2013 - 14:48
If I understand you correctly, you should split the first task into two parts (two Task(T)s), so you can queue the second task after the first part, and queue the second part after the second task.
Without risking the case of the 2 tasks running on the same thread and having them both stopped.
I want the first task to wait until another task finishes some action. After the second task is done with its action, it should wake the first task up and continue working from where it stopped. The first task should be waked up as well if the first task didn't do the action after a certain time.