20100127

NSThread

The project I'm working on uses threads. Like a good Cocoa app, the main thread is in charge of the GUI, and the worker threads run in the background so that we don't pinwheel.
In order to know when the thread has finished its work, we registered for notification:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:aSel
name:NSThreadWillExitNotification
object:thread];


and in the aSel method, use ivars to update an NSTableView's dataSource.

We had a really pesky race condition that, after two days, we realized was caused by aSel running in the same worker thread! It turns out that this is in the documentation, that notifications are served to the same thread that posts them. However, this is a fairly useless implementation decision.

Our workaround is not to register for the notification, but rather to have the thread performSelectorOnMainThread:withObject:waitUntilDone: at the end of its execution. There is still a problem that we'd like to release the thread at that point, but we don't know what will happen if we try that!

20100108

Apple, part II

The same day I received the rejection email from Apple, a different Apple recruiter contacted me on LinkedIn and asked me if I would be interested in a job at Apple. I wanted to see where it would go, so I said sure, tell me about the job. He described a position with the security testing team for all Apple products, but only very broadly. When I asked some detailed questions, he couldn't answer them, so he offered to set up a phone call with the team leader.
About 1.5 weeks after being contacted on LinkedIn, I got a call from the team leader. He described the position, and it sounded like something I'd enjoy, so I asked him how to apply for it; should I send a resume, etc. He said he had something like a resume in front of him (which I assume the recruiter copied from LinkedIn), and that I didn't have the experience or background they wanted, unless there was something I'd left off my resume.
I asked him why, if he had already decided that I didn't have the background he wanted, did he call me? He told me that he'd called me because the recruited had asked him to, because the recruiter couldn't answer my questions.