multithreading

too many threads due to synch communication

I'm using threads and xmlrpclib in python at the same time. Periodically, I create a bunch of thread to complete a service on a remote server via xmlrpclib. The problem is that, there are times that the remote server doesn't answer. This causes the thread to wait forever for a response which it never gets. Over time, number of threads in...

QProgressBar not showing progress?

My first naive at updating my progress bar was to include the following lines in my loop which is doing the processing, making something like this: while(data.hasMoreItems()) { doSomeProcessing(data.nextItem()) //Added these lines but they don't do anything ui->progressBar->setValue(numberProcessed++); ui->progressBar->...

C# BackgroundWorker RunWorkerCompleted Event

My C# application has several background workers. Sometimes one background worker will fire off another. When the first background worker completes and the RunWorkerCompleted event is fired, on which thread will that event fire, the UI or the first background worker from which RunWorkerAsync was called? I am using Microsoft Visual C# ...

Thread used for ServiceConnection callback (Android)

Hi I'm developing an activity that binds to a local service (in onCreate of the activity): bindService(new Intent(this, CommandService.class), svcConn, BIND_AUTO_CREATE); I would like to be able to call methods through the IBinder in my lifecycle methods, but can not be sure that onServiceConnected have been called prior to these...

Most suitable collection for multithreading requests?

I have ~10,000 records would like to keep in a collection in memory and execute LINQ queries against it. This collection should be available for all the users in the application domain and can access concurrently. I’m looking for a .NET collection that supports multithreading can query asynchronously and efficiently without any threadin...

Some questions regarding threads and deadlocks

will parent process and child process in deadlock if parent is using resource and child will also get same resource ? what if parent contains two threads ? will child also get 2 threads ? how can fork will be thread safe ? ...

multi threaded file processing with .NET

There is a folder that contains 1000 of small text files. I aim to parse and process all of them while more files are being populated in to the folder. My intention is to multithread this operation as the single threaded prototype took 6 minutes to process 1000 files. I like to have reader and writer thread(s) as following : while t...

Asynchronous callback for network in Objective-C Iphone

I am working with network request - response in Objective-C. There is something with asynchronous model that I don't understand. In summary, I have a view that will show my statuses from 2 social networks: Twitter and Facebook. When I clicked refresh, it will call a model manager. That model manager will call 2 service helpers to reques...

BackgroundWorker acting bizarrely...

Hi guys I'm working on some code that calls a service. This service call could fail and if it does I want the system to try again until it works or too much time has passed. I am wondering where I am going wrong as the following code doesn't seem to be working correctly... It randomly only does one to four loops... protected virtual ...

When knowledge of "multithreading" is specified in a C++ job description, what is the expectation?

I understand it should cover threading primitives (mutex, semaphore, condition variables etc.) plus design patterns (such as those specified in POSA2). But what's more? Every project has its own multithreading scenarios and one may have not dealt with those that the job is expecting?. So how does one build their knowledge and prove that ...

Difference between Locks, Mutex and Critical Sections

There is an existing question regarding difference between Mutex and Critical section but it does not deal with Locks also. So i want to know whether Critical sections can be used for thread synchronisation between processes. Also what is meant by signalled states and non-signalled states ...

Long running operations (threads) in a web (asp.net) environment

I have an asp.net (mvc) web site. As the part of the functions I will have to support some long running operations, for example: Initiated from user: User can upload (xml) file to the server. On the server I need to extract file, do some manipulation (insert into the db) etc... This can take from one minute to ten minutes (or even more ...

One write-thread, one read-thread on the same socket?

Hello, i am running eCos with the FreeBSD TCP/IP-stack. Is it safe to have two threads running one to read from a socket and one to write to the same socket? Well i guess since its the FreeBSD stack the operating system does not matter. Best regards, Friedrich ...

Please tell me what is wrong with my threading!!!

I have a function where I will compress a bunch of files into a single compressed file..it is taking a long time(to compress),so I tried implementing threading in my application..Say if I have 20 files for compression,I separated that as 5*4=20,inorder to do that I have separate variables(which are used for compression) for all 4 threads...

If a method does not use object's fields then it is thread safe?

If a public method of an object only uses parameters passed, and local variables, then can we say that it is thread-safe? ...

Sleeping a thread is blocking stdin

Hey, I'm running a function which evaluates commands passed in using stdin and another function which runs a bunch of jobs. I need to make the latter function sleep at regular intervals but that seems to be blocking the stdin. Any advice on how to resolve this would be appreciated. The source code for the functions is def runJobs(comp...

Kernel thread exit in linux

Hi guys, I'm here to ask you the difference between a process and a thread in linux. I know that a thread for linux is just a "task", which shares with the father process things that they need to have in common (the address space and other important informations). I also know that the two are creating calling the same function ('clone()'...

Multhreading in Java

I'm working with core java and IBM Websphere MQ 6.0. We have a standalone module say DBcomponent that hits the database and fetches a resultset based on the runtime query. The query is passed to the application via MQ messaging medium. We have a trigger configured for the queue which invokes the DBComponent whenever a message is availabl...

Tomcat threads vs Java threads

When using java threads, one has to take care of the basic problems that come with concurrency through synchronization etc. AFAIK Tomcat also works with threads to handle its workload. Why is it, that I don't have to think about making my code threadsafe when it is running in Tomcat? ...

objective-c : @synchronized how it works ?

Hi, i have two methods -(void) a { @synchronized(self) { // critical section 1 } } -(void) b { @synchronized(self) { // critical section 2 } } now my question is if a thread is in critical section 1. will the critical section 2 be locked for other threads or other threads can access critical section 2. ...