multithreading

Why would I use "Both" COM threading model instead of "Free"?

According to this article if I register my COM object with either "Both" or "Free" threading model that object must be completely thread-safe. Specifically all accesses to global shared variables must be synchronized and all accesses to member variables must also be synchronized. That's a lot of effort. Now I understand that being able ...

Database operation via Threadpool or Asyn programming

Hi guys, i have database with larger number of records.(database values are updated via a webservice) Each record/row is of type (id,xmlfilename,operation,parameters,operationId,status) ie. we have perform operation as specified by'operation' on a xmlfile specified by "xmlfilename" with parameters for operation specified by "parameter...

right way to create thread in ASP.NET web application

Hello, i'm creating asmx web service and have to create thread to do background IO to refresh system data. What is the right way? I'm not interested to get any results to creating thread. I just want the ASP.NET worker thread to create a thread that does it's loading and in the end makes one assign (I think assign _alldata = newData is a...

Datatable update in different thread (WPF)

Hi, I have a Datatable assigned to a DataGrid in main thread. I am updating the same DataTable from two different thread classes. Although the rows gets updated successfully in DataGrid control, I get following execption: NotSupportedException thrown, with the message saying 'This type of CollectionView does not support chan...

Is an Event running in another thread? (.Net Compact Framework).

Hello! I'm developing a Windows Mobile 5.0 or above with .Net Compact Framework 2.0 SP2 and C#. when I try to access the control's width on a method that handles an event it throws me the following exception: Control.Invoke must be used to interact with controls created on a separate thread. Is this method running in another thread? ...

Java - How to know when thread is waiting?

Is there any neat solution of knowing when a thread has been put into wait status? I am putting threads to wait and I notify them when i need it. But sometimes I want to know if a thread is currently waiting, and if so, I have to do something else. I could probably set a flag myself to true/false. But I can't imagine there is a better w...

Getting list of currently active managed threads in C#/.NET?

For a "log information for support" type of function I'd like to enumerate and dump active thread information. I'm well aware of the fact that race conditions can make this information semi-inaccurate, but I'd like to try to get the best possible result, even if it isn't 100% accurate. I looked at Process.Threads, but it returns Proces...

Building a multithreaded work-queue (consumer/producer) in C++

Hey all, I have the following scenario: I have a single thread that is supposed to fill a container with pairs of integers (in essence, task descriptions), and I have a large number of worker threads (8-16) that should take elements from this container and perform some work. I thought the problem could be easily solved by a blocking q...

Strategies for multithreaded application

I might inherit a somewhat complex multithreaded application, which currently has several files with 2+k loc, lots of global variables accessed from everywhere and other practices that I would consider quite smelly. Before I start adding new features with the current patterns, I'd like to try and see if I can make the basic architecture...

How can I access my class instance from a boost thread?

I have the following code (this is some semi-sudo code, which may not compile): class FooBar { public: void a(); void b(); boost::shared_ptr<boost::thread> m_thread; std::string m_test; }; void FooBar::a() { m_test = "Foo bar" m_thread = shared_ptr<thread>(new thread(bind(&FooBar::b, this))); } void FooBar::b()...

Java threads: interpreting thread states of a running JVM

A Java thread is always in one of the following ten states: NEW: Just starting up, i.e., in process of being initialized. NEW_TRANS: Corresponding transition state (not used, included for completness). IN_NATIVE: Running in native code. IN_NATIVE_TRANS: Corresponding transition state. IN_VM: Running in VM. IN_VM_TRANS: Corresponding tra...

Sharing a db connection between threads in a C# application?

I have found there to be very little information on this topic, was hoping someone could direct me to some information and possible sample code - Thanks! ...

Limiting Thread Execution Processor Cycles in Java

Hey, I'm writing an AI-testing Framework for a competition. Participants submit a Bot class which matches a given Interface. Then all the bots play a turn-based game. On every turn, I want to do the following: For every bot B: start a thread that runs at most N cycles and does B.getNextMove() wait for all threads to complete Mak...

.Net How to get notified efficiently when a thread is suspended?

Hi, Does anyone know a way to get notified when a specific thread is being suspended and resumed? I would like to be able to to something like this: thread.Suspended += delegate { //Do something }; thread.Resumed += delegate { //Do something else }; I doubt that the .Net Framework has this capability, but is there a techniq...

multithreading in c#

hi i am new to threading. my boss gave me a scenario.we have a list of object which is 0f 70gb,we want to load it from a database.it takes time i want to utilize cpu(multi threading) in this scenario .i.e partializing data ,load first part, than second part,whensecond part is loaded mean while first part is processed, what i shuld do ple...

ASP.NET Threading: should I use the pool for DB and Emails actions?

I’m looking for the best way of using threads considering scalability and performance. In my site I have two scenarios that need threading: UI trigger: for example the user clicks a button, the server should read data from the DB and send some emails. Those actions take time and I don’t want the user request getting delayed. This scen...

what happens to ASP.NET exceptions from created non-threadpool thread?

Hi, In ASP.NET web application a worker thread creates a non-threadpool thread like below: private static bool _refreshInProcess = false; public delegate void Refresher(); private static Thread _refresher; private static void CreateAndStartRefreshThread(Refresher refresh) { _refresher = new Thread(new ThreadStart(refresh)); _r...

StringBuffer append("")

I'm currentlly refactoring an application using a lot of this: StringBuffer buff1 = new StringBuffer(""); buff1.append("some value A"); buff1.append(""); buff1.append("some value B"); The coder that made those code lines didn't seems to be an idiot, is there any reasons I can't see to use the append("") to a StringBuffer? ...

Threadding clients using a tcp listner.

Hi all (Using vb 2008 express.) I am trying to create a server to send clients text on request. I am using a tcp listener to accept clients then send each client to a thread in a threadpool which deals with each client's request then closes the client connection. It seems to work fine but I would like to know how it works. Using the lis...

Ordering of thread using ThreadPool.QueueUserWorkItem

hi guys, I'm new to threading basics. I have a queue of operations to be performed on a XML files(node add,node delete etc) 1]There are 'n' xml files and for each file a thread from thread pool is allocated using ThreadPool.QueueUserWorkItem to do those file operations. I want to achieve both concurrency and ordering of operation(im...