Hi,
I am using a API to access a Datasource in a Web
Application.The API is purely single threaded.
When there are more than one user trying to access the
data.the API crashes and this inturn kills the ASpnet
worker process.

Can anybody help me out with how to proceed to write a
Wrapper class so that i can achieve crash free experience.

Any help will be highly appreciated

Regards
Abdul Rahman

Re: Threading Problem by Nick

Nick
Sat Oct 25 02:19:54 CDT 2003

The easiest option would be to wrap the single-thread object in a .NET
object that was thread-safe:

public class DataSourceWrapper{
private static object _dataSource = new DataSource();
public static void UseDataSource( /*add required params here*/){
lock(typeof(DataSourceWrapper)){
//code to use _dataSource here;
}
}
}

If the single-threaded API is used to service a lot of requests, there will
be a significant performance and scalability problem on the site.

Nick Wienholt, MVP
Maximizing .NET Performance
http://www.apress.com/book/bookDisplay.html?bID=217
Sydney Deep .NET User Group www.sdnug.org

"Abdul Rahman" <anonymous@discussions.microsoft.com> wrote in message
news:060701c39aad$5a2faf00$a501280a@phx.gbl...
> Hi,
> I am using a API to access a Datasource in a Web
> Application.The API is purely single threaded.
> When there are more than one user trying to access the
> data.the API crashes and this inturn kills the ASpnet
> worker process.
>
> Can anybody help me out with how to proceed to write a
> Wrapper class so that i can achieve crash free experience.
>
> Any help will be highly appreciated
>
> Regards
> Abdul Rahman



Re: Threading Problem by AlexS

AlexS
Sat Oct 25 10:57:44 CDT 2003

General idea is
- move ALL single-threaded code and objects into thread body
- don't reference single-threaded objects and code from outside enclosing
thread

Rationale: for simplicity sake you can consider thread as separate process.
If you can run 2 and more instances of your application without crashes
chances are you can use API in multi-threading mode. If you can't do this,
your API is really not suitable for threading.

HTH
Alex

"Abdul Rahman" <anonymous@discussions.microsoft.com> wrote in message
news:060701c39aad$5a2faf00$a501280a@phx.gbl...
> Hi,
> I am using a API to access a Datasource in a Web
> Application.The API is purely single threaded.
> When there are more than one user trying to access the
> data.the API crashes and this inturn kills the ASpnet
> worker process.
>
> Can anybody help me out with how to proceed to write a
> Wrapper class so that i can achieve crash free experience.
>
> Any help will be highly appreciated
>
> Regards
> Abdul Rahman