473,402 Members | 2,053 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,402 software developers and data experts.

ASP.NET (thread safe? ) Page / DTS Package execution.

I have a DTS package that can be execute from ASP.net and I was
wondering if there is a way to make this thread safe some how. I know
thread safe isn't exactly the word I'm looking for but let me know
what the correct term is. What I have is an asp.net page that executes
a DTS package and I want to be sure no two people will click a submit
button on this page from 2 different computers at the same time. And if
they do I want one to be locked until the other person's request is
done processing or at least notify the user to try again. I would
prefer to find a way to notify the person and do this in ASP.net
because I have some other pages that need to be done this way with
plain SQL update queries that aren't DTS;(I do use transactions and
locking) but I was wondering if I can just find out of another person
is on the same page, or if its processing that page from another
instance of Iexplorer. If this isn't possible, a way to prevent this
in the DTS package would work almost as well. Any ideas are
appreciated, Thanks!

Nov 19 '05 #1
4 1802
Dwight:

You can wrap the code inside of a Monitor.TryEnter and a Monitor.Exit. Specify
a timeout value for TryEnter and if the method returns a false - someone
else still has the lock and you can notify the user. A Monitor will only
permit one thread to execute the code it is guarding.

--
Scott
http://www.OdeToCode.com/blogs/scott/
I have a DTS package that can be execute from ASP.net and I was
wondering if there is a way to make this thread safe some how. I know
thread safe isn't exactly the word I'm looking for but let me know
what the correct term is. What I have is an asp.net page that executes
a DTS package and I want to be sure no two people will click a submit
button on this page from 2 different computers at the same time. And
if
they do I want one to be locked until the other person's request is
done processing or at least notify the user to try again. I would
prefer to find a way to notify the person and do this in ASP.net
because I have some other pages that need to be done this way with
plain SQL update queries that aren't DTS;(I do use transactions and
locking) but I was wondering if I can just find out of another person
is on the same page, or if its processing that page from another
instance of Iexplorer. If this isn't possible, a way to prevent this
in the DTS package would work almost as well. Any ideas are
appreciated, Thanks!

Nov 19 '05 #2
I thought of that, i didnt try it because i didnt think it would work
that way in ASP.net. Im not too famaliar with the inner workings but i
just assumed that wouldnt apply in asp.net like it does in windows
forms. I will still try it. Its difficult to reproduce the problem I
am having. Ill keep you updated.

Nov 19 '05 #3
I was just thinking. Would the monitor still work on a dual processor
cpu ? Im not totaly sure how far up the monitor goes, but possibly to
the appdomain? Im not sure, but im wondering if each processor gets an
appdomain. Im also wondering if i should or could use the application
object to store a boolean weather its locked. I might be going
overboard but for some reason I keep having a doubt that the monitor is
safe. i thought about using a static class to help but im not sure when
it would get destroyed. (im not just asking scott, but whomever)
Thanks!
-Dwight

Nov 19 '05 #4
Monitors do work on MP machines - if they didn't we'd all be in big
trouble :).

Monitors do not work across appdomains. In general you won't have to
worry about that unless you have webgardens enabled on a 2003 server.
A static isn't necessarily the whole solution, as you'd still need to
synchronize access to the static member.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 26 Jan 2005 23:01:14 -0800, "dwight0" <dw*******@yahoo.com> wrote:
I was just thinking. Would the monitor still work on a dual processor
cpu ? Im not totaly sure how far up the monitor goes, but possibly to
the appdomain? Im not sure, but im wondering if each processor gets an
appdomain. Im also wondering if i should or could use the application
object to store a boolean weather its locked. I might be going
overboard but for some reason I keep having a doubt that the monitor is
safe. i thought about using a static class to help but im not sure when
it would get destroyed. (im not just asking scott, but whomever)
Thanks!
-Dwight


Nov 19 '05 #5

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

Similar topics

0
by: Roman Suzi | last post by:
Hi! Just to be sure, is email package of Python 2.3 thread-safe or not (to use, for example, in python-milter?) Sincerely yours, Roman A.Souzi
5
by: Roman Suzi | last post by:
(this is a repost with an addition - probably noone noticed my message first time) Hi! Just to be sure, is email package of Python 2.3 thread-safe or not (to use, for example, in...
9
by: Andy Chang | last post by:
Hi, If I have this function void DoSomething(int& index) { ::Sleep(10000); DoSomethingWith(index); } Is the variable index thread safe? Meaning that if I call this from two
20
by: Sacha | last post by:
Consider I have a working thread like this, while (1) { if ( g_pObject ) g_pObject->DoOneStep(); } with an class hierarchie like this
5
by: Dan Tallent | last post by:
I am trying to learn how to create an application that uses worker threads to prevent the UI from freezing up. My question is: Is the following code considered "thread safe"? If not, what am I...
1
by: Tommaso Caldarola | last post by:
If I call System.Runtime.Remoting.CallContext.SetData() and then I call System.Runtime.Remoting.CallContext.GetData() from a different thread I get null, if the thread indeed is the same I get...
1
by: philwozza | last post by:
Hi I have a THREAD class that uses the static variable NextThreadID to store the id of the next thread to be created and a static Mutex to protect it. class THREAD { public: int Start(void);...
44
by: climber.cui | last post by:
Hi all, Does anyone have experience on the thread-safty issue with malloc()? Some people said this function provided in stdlib.h is not thread- safe, but someone said it is thread safe. Is it...
0
by: Steve Holden | last post by:
Allen Taylor wrote: You can publish it in the Python package index - see http://pypi.python.org/pypi/ If you want to have it considered for inclusion into future versions of Python then you...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.