Re: ThreadStaticAttribute and threadpool

Discussion in 'ASP .Net' started by bruce barker, Jul 11, 2003.

  1. bruce barker

    bruce barker Guest

    a thread static will live the life of the thread. in asp.net, you are right,
    there is a thread pool, with a min and max, so the life of a thread is hard
    to predict. also asp.net plays fast and loose with its thread management, so
    that there is no guarantee that the same thread is used for all of a page
    processing. you can set aspcomat to true to force only one thread a page
    request. you may want to context storage instead (say use application cache
    which is context based) .

    thread statics are only intialized once, so when the thread is pulled from
    pool, the static will have the last value saved it in, so, you need to init
    it every time.

    -- bruce (sqlwork.com)

    "Calvin" <> wrote in message
    news:02c701c347dd$c49cc9e0$...
    > I assume every request is using a different thread, am I
    > right?
    >
    > If a request is retriving a thread from a threadpool
    > instead of creating a new thread (is this the case in
    > IIS), what will happen to thread static variable?
    > [threadstatic].
    >
    > I have applications depending on thread variable, I am not
    > sure those thread static variable is resetted or not. And
    > it's hard to test!
    >
    > Anyone has some inside knowlodge of this?
    >
    > Thanks,
    >
    > Calvin
    bruce barker, Jul 11, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Browne

    Re: ThreadStaticAttribute and threadpool

    David Browne, Jul 11, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    423
    David Browne
    Jul 11, 2003
  2. Scott Allen
    Replies:
    1
    Views:
    1,927
    Henri
    Dec 14, 2004
  3. Douwe
    Replies:
    0
    Views:
    707
    Douwe
    Dec 8, 2005
  4. Replies:
    3
    Views:
    1,079
    Samuel R. Neff
    Oct 17, 2007
  5. Philipp Kraus

    threadpool and ui paint

    Philipp Kraus, May 13, 2014, in forum: Java
    Replies:
    6
    Views:
    105
    markspace
    May 13, 2014
Loading...

Share This Page