C# multithreaded windows service, private or [ThreadStatic] -
i'm in process of converting console application wrote single windows service windows service supports multithreading. however, first go around multithreads.
i wondering if should make every class private static instead of public static , has remain public, attach [threadstatic] attribute.
basically code lot of string work html crawling , places select data in mysql database.
the answer first question no; adapting code support multiple threads not (necessarily) mean need change member or type accessibility.
as second question, use threadstatic
on fields (not types) if need each thread have own independent static field (otherwise threads share same static field).
Comments
Post a Comment