Hello again and sorry to tell that it is probably a "major bug" in PortableTPL.
As you know in WP7, there is the UI thread, the compositor thread (the developer can't use it, I hope to be able to convolute bitmaps faster with it soon) and Microsoft gives the developers 2 threads in an application.
As I said if the code runs on the UI thread, no problem, the result displayed is:
Task1 and Task2 are running on 2 new threads, but if I run the same code on Task0, Wp7 UI thread creates the task0 thread . The problem occurs now:
Wp7 must run 2 Tasks with only 1 thread left. To do so, in my custom test, Wp7 reuse task0 thread to execute task1 and starts the last thread available to execute task2.
The result with PortableTPL is : task0 thread = task1thread , so waitall asks task0 thread to wait for thread task1 and thread task2, but since thread task0 = thread task1, task1 WaitEvent(manualresetevent) is never set and task0 is waiting for continously.
The bug can be reproduced easily in WP7 emulator because of the 2 threads limitations available in an app.
Since Silverlight or XBox360 can run more threads, this bug occurs only in few cases, but can result in data corruptions too.
Today, I think it is a limitation in WP7 and I recommend to run a task only on the UI thread and not inside another task or you will probably loose one thread or more (and there is no timeout to reset the thread lost).
I hope you will answer me I'm making a big mistake or you will find a solution to the problem.