multithreading

How to implement an alarm with iPhone SDK 4.0

I have an idea for a pretty unusual alarm clock fir the iPhone. But as of now I have some thoughts on how to actually implement this. First off: forgetting about background services for now, how would I do the actual timer that fires the alarm etc? A separate thread? Or does the SDK include any nice alarm features I missed? Of cause I ne...

Can I send locations to a server in background on Iphone?

Hello, I'm looking for the answer to my question but it's quite difficult for me. I would like to keep connected to the server in background sending location of the iphone with ios4. I`m really sad because I think that multitasking of apple is not real multitasking, in fact they only keep the state of the app but they don't allow it to...

Threading only block the first thread (Attempt Two)

I have asked this question before - but I have spent some time thinking about it and have implemented a working version. Overview 1) Threads are being created to perform a certain task. 2) Only one thread can perform the task at a time. 3) Each thread performs the exact same task. (Does a bunch of checks and validations on a system) 3)...

text editor loading multiple large text files - multi threaded

I'm fairly new to VB.NET, and I'm working on a text editor with a tabbed interface. I deal with large text files, so I'm wondering what is the best way to go about this. Should I have each tab / text document open up in a new thread or a process? I basically want the entire application to always run fast as the text editor is just one ...

Force the iPhone to simulate doing CPU-intensive tasks?

For a normal app, you'd never want to do this. But ... I'm making an educational app to show people exactly what happens with the different threading models on different iPhone hardware and OS level. OS 4 has radically changed the different models (IME: lots of existing code DOES NOT WORK when run on OS 4). I'm writing an interactive t...

Difference between LoopingCall and callInThread in Python's Twisted.

I'm trying to figure out the differences between a task.LoopingCall and a reactor.callInThread in Twisted. All my self.sendLine's in the LoopingCall are performed immediately. The ones in the callInThread are not. They're only sent after the one in the LoopingCall has finished. Even though I'm sending the right delimiter. Why is that? ...

Win32 -- how to manage my mouse hook thread

I have successfully gotten my low-level mouse hook code to work, but there are some behaviors I'm observing that I don't quite understand. Everything works fine if I spawn a thread which installs the mouse hook. When i no longer need it running, I let the thread get destroyed automatically as I exit the program, and I imagine I can easil...

How can I get a least recently used algorithm to work with multiple threads?

I'm using a memory pool to store image data in a ray tracer and I'm using a least-recently-used algorithm to deal with freeing blocks of memory. This works fine when there is only one thread. When I add more threads, the LRU code breaks. I'm using a linked list to store the history of which blocks have been accessed and this is the part ...

Python Threading String Arguments

I have a problem with Python threading and sending a string in the arguments. def processLine(line) : print "hello"; return; . dRecieved = connFile.readline(); processThread = threading.Thread(target=processLine, args=(dRecieved)); processThread.start(); Where dRecieved is the string of one line read by a connection. It cal...

Implementing a wrapper around threadpool

I've noticed a common pattern in some code I'm writing so I decided to extract it into a class. However, since starting to use this class I've been having a problem where every once in a while the program will hang indefinitely, and, from what I can tell from debugging, this class seems to be the cause. Could sometime tell me what I'm ...

Thread safe Hash Map ?

Hi Guys, I am writing an application which will return a HashMap to user. User will get reference to this MAP. On the backend, I will be running some threads which will update the Map. What I have done so far? I have made all the backend threads so share a common channel to update the MAP. So at backend I am sure that concurrent wri...

how to code thread synchronization using any method - eg ..Cevent

hello there I am trying to code a simple application which would help me in reading from a serial port and write to the same serial port using a single thread ...so could someone please help me to manage the synchronization between the threads.heres the source code- the whole project file in Visual studio 6 - http://rapidshare.com/files/...

Randomly endless thread and various bugs, while parallel line-by-line reading/writing

Hi, I want to implement a parallel reading-processing-writing line by line based on boost::thread, but the current version has indefinite behaviour : the following test reads a CSV file by filling the read (concurrent) queue, which is simply transferred into the writing queue to be written in an output file (no processing for now). Pro...

Reading after "Java Concurrency In Practice" for more concurrency examples?

Many people at SO adviced to dive into Java concurrency by reading Java Concurrency in Practice (JCIP), sometimes Doug Lea's book of 1999 is mentioned as well: http://stackoverflow.com/questions/1237980/java-5-concurrency-book-recommendations http://stackoverflow.com/questions/452391/recommended-books-on-concurrency-synchronization-mec...

Websites/Books that have homework assignments for C#

Are there any websites or good books out there that have assignments like: Create a BackgroundWorker thread... blah blah blah I'm not a beginner programmer at all I actually have my degree as a computer programmer analyst but I would like to get more sharp with advanced concepts such as Threading, Generics, LINQ, DLINQ, etc. Thanks!...

Finding .NET Multithreading Bottlenecks

Greetings. I have a .NET application running a bunch of simulations in parallel. It's doing a parameter sweep, so each parameter has its own Parallel.Foreach loop. I normally set the max parallelism to one in all but one of loops, to keep memory requirements down, since each parameter can take more values than I have cores available (4)...

Unexpected '\n' in Ruby Fiber

I'm trying to wrap my head around multithreading, so I'm playing around with Fibers in Ruby. However, when I try to run my script, it tells me I have an unexpected newline character after my ternary statement. Did I miss something about the syntax, here? timer = Fiber.new do |power| power = power.nil? ? 'on' | power start = Time.no...

How to synchronise two NSManagedObjectContext

Hi everybody, I'm working on an ipad application that use coredata. It download information on a database that is on the web, and record them in coredata. The application is based on a split view. My problem was to make the download and the record of the data in background. Here is how I've done : - I've create an NSOperation, that does ...

memory for multiple user level thread stacks

Hello, I want to understand how is the memory for the stacks of the user level threads kept in memory. I think that all the stacks would begin at a page boundary... Am I right?? How does the user level thread library ensures that the stack for a certain thread wont grow and overlap with the contiguous page boundary stack of the other th...

CGContextSetShadowWithColor problem..

Hi, plz look at the code first UIGraphicsBeginImageContext(self.view.frame.size); contextRef=UIGraphicsGetCurrentContext(); CGContextSetLineCap(contextRef, kCGLineCapRound); CGContextSetLineWidth(contextRef, brushWidth); CGContextSetRGBStrokeColor(contextRef, 1.0, 1.0, 1.0, 1.0); CGColorSpaceRef color...