It sounds like you actually want to *recreate* that state for each StartNew
instead of having a constant state for each thread as LifeStylePerThread
does.
When using System.Threading.Tasks you probably shouldn't assume any
particular thread distribution or assignment most of the time. For example,
it's possible to run an entire Task computation synchronously. One of the
points of these abstractions is that you don't have to mess with threads
yourself.





--
Mauricio



On Mon, Nov 26, 2012 at 2:35 PM, mynkow <[email protected]> wrote:

> Hi,
>
> imagine a class which holds some state. This state should be unique for
> every thread. So I register the component with LifeStylePerThread. This
> state is set only once when the object is created.
>
> The problem is that some threads are reused and when I call
>
> Task.Factory.StartNew(...) I get an existing thread with already
> initialized state. I tried to force creating a new thread every time a new
> Task is started but it is impossible.
>
> Is there any workaround this problem?
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/castle-project-users/-/tFMByj4aRWwJ.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to