multithreading

How to make iPhone OpenGL ES context update straight away?

I have an OpenGL ES application for the iPhone I am developing, being a port of a 2d-oriented application from another platform. I have chosen to render the graphics using OpenGL ES for performance reasons. However, the main application runs on a separate thread (due to the original application design), so from within my app delegate I d...

Monitoring background Threads

I am trying to monitor a thread that i set running in the background. I need to be alerted when it is finished executing. - (IBAction) btnGreaterTen_clicked :(id)sender{ self.searchDistance = [NSNumber numberWithDouble : 10]; CGRect frame = CGRectMake (120.0, 185.0, 80, 80); activity = [[UIActivityIndicatorView alloc] in...

help in synchronized method in java

Hi everyone... I've write a program with java that simulate production water with synchronization (Oxygen wait for Hydrogen to become available), but it's gives "Unexpected Operation Exeption" and did'nt work... Please help me... there are my codes: // class for thread Oxygen public class Thread_O implements Runnable { Object object;...

Condition variables in C#

Are condition variables & monitors used in C#? Can someone give me an example? ...

Interrupt handlers executed in a different thread?

I wanted to know when the processor get's interrupted and an ISR (interrupt service routine) is executed, is that executed in the context of the thread that was interrupted to handle this interrupt or is it executed in its own thread and then goes back to where it left of in the original thread? So a context switch actually occurs when ...

Thread security in sandboxed AppDomain

I have application domain to host untrusted code/assembly. I solved all problems with security with security attributes and it works well. The untrusted code runs on dedicated thread. CLR is 2.0. This is what I have AppDomainShell AppDomainSeed, Shell is running in main domain, seed is trusted proxy/helper in untrusted domain. I'm inter...

Multi-process webserver vs multi threaded web server?

I would like to know why we prefer to make web servers multi-threaded instead of make it multi-process web servers .... Is it because of legacy issues..... I would like to hear practical reasons as well as theoretical reasons ...

Am I using ThreadPool.QueueUserWorkItem properly?

I am working on a ASP.NET MVC app. I wanted to spawn few threads when a event occurs, I dont care for the return value of my threads and I wanted to make a async call so I am using ThreadPool.QueueUserWorkItem , public event SomeEventHandler SomeEvent; private void SomeEventhappened(UserProfile arg) { SomeEventHan...

What exactly means locking on an object?

Hi, Altough I am using locks in my app, I do not understand what exactly does locking on particular reference type. I thought it just stops the thread until the content of {} is finished. But I have read that locking(this) is bad, if its public - why? The article explained it but I do not understand sice I do not know what happened to th...

Windows API similar to pthread_cancel?

Is there a Windows native API analogous to pthread_cancel, pthread_testcancel etc? If not, how can we simulate cancelling of one thread from another using the pthread_cancel mechanism in Windows? ...

APC execution context question?

When an Asynchronous Procedure Call (APC) occurs it is executed 'Asynchronously' to the current context of the thread. Per this MSDN info: APC Now my question is, what exactly does it mean 'execute asynchronously to the context of the current thread'? Is it that executes besides what the thread is already executing, or is the thread i...

Multithreading and "just leaking" warning

I'm creating a new thread like this: [NSThread detachNewThreadSelector: @selector(myMethod:) toTarget:self withObject:filePath]; and in the method I do: - (void) myMethod:(NSString*)path{ NSAutoreleasePool *pool = [NSAutoreleasePool alloc]; [UIImagePNGRepresentation(theImage) writeToFile:[path stringByAppendingString:@".png"] atomic...

How can I load an ASP.NET GridView from multiple sources asynchronously?

Here is the situation. I need to hit ~50 servers and grab some data from a file. I then want to display a few rows for each in an ASP.NET GridView control. I tried doing this with Threads/ThreadPool and successfully gather all the data in session. What I'd like to do, and what I am having a hard time figuring out, is update the grid fo...

Implementing synchronization algorithm in C#

Hi I trying to implement synchronization algorithm in C#, without success. Why isn't the following code thread safe? using System; using System.Threading; namespace SoftwareLockTest { class Program { private static volatile bool _isLocked1 = false; private static volatile bool _isLocked2 = false; priva...

How to increase concurrent parallel tasks with System.Threading.Parallel (.Net 4.0)

Hi, I'm experimenting with the new System.Threading.Parallel methods like parallel for and foreach. They seem to work nicely but I need a way to increase the number of concurrent threads that are executed which are 8 (I have a Quad core). I know there is a way I just can find the place thy hidden the damn property. Gilad. ...

creating multiple threads to upload to s3

I am uploading files to s3 using amazons s3 web service. It takes about 1 second per file, is there a way I could fire up multiple threads to do this in parallel? Say I have a method that does the upload call: public void uploadToS3(string filename); how can I call fire up 3 threads and each make this call? ...

Drawing/Rendering a UIView Within a Separate Thread so NSTimer Always Fires Timely

I'm using a NSTimer to fire a drawRect within the app's main view. The drawRect draws a few images, and blends each using kCGBlendModeScreen (which is an absolute must). However, the drawRect takes just a tad longer than desired, so the timer doesn't always get fired at the desired rate (more like half as often). I've optimized the grap...

Simple Threads Behaviour in Java

/* Multiple Threads Executing * Author Myth17 */ class T1 implements Runnable { public void run() { for(int c=0;c<10;c++) System.out.println(Thread.currentThread().getName()+" running...."); } } class T2 implements Runnable { public void run() { for(int c=0;c<10;c++) System.out.prin...

How to write correct static methods - multithread safe

As I assume static methods shouldn't be writen like the first snippet , or am I wrong ? public static class ExtensionClass { private static SomeClass object1; private static StringBuilder sb; private static string DoSomething() { sb.AppendLine(object1.SomeValue); } public static string ExtensionMethod(this HtmlHelper helper,...

D-Bus threading model

I am starting to use D-Bus as the IPC mechanism for a new project in Linux/KDE. And I've discovered that the documentation does not really address concurrency at all. How are D-Bus services expected to deal with multiple concurrent calls coming in from different clients? What's the threading model? Can a service assume that it is single-...