473,385 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Do compiled library dll's in ASP.NEt need to be thread safe?

Don't see any official notice that compiled library dll's loaded in the BIN
directory of an asp.net website need to be thread safe, but concurrent visits
to the same web site sure bear this out. Does anyone know the answer to this?
Jun 27 '08 #1
3 1506
Hi,

you need to also understand that in ASP.NET page and control objects are
instantiated for every request, so thread safety is to consider when you
deal with global variables like static variables, cache etc. Within single
page, in real world, you need thread safety less than you might think.
ASP.NET is designed to avoid this need because writing good, thread-safe
code is actually pretty demanding.

See: http://msdn.microsoft.com/en-us/magazine/cc163929.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"jpatrcik" <jp******@discussions.microsoft.comwrote in message
news:4A**********************************@microsof t.com...
Don't see any official notice that compiled library dll's loaded in the
BIN
directory of an asp.net website need to be thread safe, but concurrent
visits
to the same web site sure bear this out. Does anyone know the answer to
this?

Jun 27 '08 #2
There is no such thing a "thread safe compiled DLL".
Only code can be thread safe or not safe. And if you compile thread safe
code into DLL then it's going to be thread safe DLL (if you want to say
that)

Considering that you writing a code for DLLs that end up in BIN folder your
question is not making sense as it is.....

If you talking about standard .NET library then it's well documented in
MSDN which classes/methods are thread safe and which are not.
Mostly they all not thread safe.... But keep in mind that .NET serializes
request to the same Session. Meaning if one browser sent 2 requests then
second request will execute only when first request has finished. Different
people will get different Sessions so one person will not wait till first
request ends.
George.
"jpatrcik" <jp******@discussions.microsoft.comwrote in message
news:4A**********************************@microsof t.com...
Don't see any official notice that compiled library dll's loaded in the
BIN
directory of an asp.net website need to be thread safe, but concurrent
visits
to the same web site sure bear this out. Does anyone know the answer to
this?

Jun 27 '08 #3
there are several levels of thread safe.

1) whether the code supports multiple threaded applications. all .net code
supports this, but not all c code.

then for objects:

2) can a object created on thread be accessed by another thread. (vb6 com
objects are an example where this can not be done safely).

3) if the object allows above, can two threads access it at the same time.
in the .net docs, this is what is meant by thread safe. some of the .net
runtime is, and some isn't.

for asp.net, #2 is required. the only exception is sta (vb6) com objects.
for sta com objects, aspcompat must be set. to handle this case asp.net
creates the com object on a single thread, and all calls are proxied (made)
from that thread.
-- bruce (sqlwork.com)
"jpatrcik" wrote:
Don't see any official notice that compiled library dll's loaded in the BIN
directory of an asp.net website need to be thread safe, but concurrent visits
to the same web site sure bear this out. Does anyone know the answer to this?
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Wardeaux | last post by:
All, Wanting to find a way to create web pages to add to my website without having to recompile the codebehind everytime I want to add a new one... Here's the deal: I have a web app that takes...
1
by: Jed | last post by:
I have a DLL that I compiled to CodeAsset.dll. The version is 1.1.0.0. If I rename the file from CodeAsset.dll to CodeAsset.1.1.dll, reference it in a web project, recompile the web project,...
2
by: David | last post by:
Hi all, I am new to .Net environment. I have created a flat non-COM DLL from Visual C++ 6.0. It stores up a function pointer from caller, create a worker thread via WIN32 API, and then call...
7
by: Brett | last post by:
Say I have a DLL with a method that does a file write. I call this DLL from an application and pass the file path and name to the FileWrite() method inside the DLL. The application is multi...
0
by: Jason | last post by:
I am writing an application (Web Service) that needs to access a legacy C DLL that is thread unsafe. I have written a VB DLL wrapper for the C DLL but can't seem to get around the fact that it is...
10
by: Julian | last post by:
I get the following error when i try to link a fortran library to a c++ code in .NET 2005. LINK : fatal error LNK1104: cannot open file 'libc.lib' the code was working fine when built using...
5
by: Gregory Gadow | last post by:
All done in ASP.Net 2.0 using VB... The website I am developing has a large DLL that includes custom MembershipUser, MembershipProvider and RoleProvider classes, several frequently used web...
16
by: John | last post by:
Does the length of my C variable names have any affect, performance-wise, on my final executable program? I mean, once compiled, etc., is there any difference between these two: number = 3; n =...
5
by: Fei Liu | last post by:
Hello, I have a situation where I need to design a library for multi-thread application, each thread does some work in a client supplied std::ptr_fun(free_function) or a functor. Now since it's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.