iOS SDK has its own NSThread (class reference here) class to handle thread operations, and using it is pretty simple:
In the above source, func_to_call is the function to be performed in the thread and parm_to_func (can be nil) is the parameter to be passed to func_to_call. If one would like to call functions in the main thread from child thread (probably you want to do this when the child thread is going to end and notifying the main thread is required), using the following:
In this line, func_in_main is the function to be called in main thread.
Note: The above method should be compatible with iOS 3.x.
Saturday, November 6, 2010
Thursday, October 14, 2010
Macbook Pro cannot boot up with continuous beep and black screen
Today my colleague told me that his 13" macbook pro (2009 ver.) cannot boot up with black screen. After taking a look, I found that it even gives out crazily annoying beep sound continuously (beep-beep-beep, halt, beep-beep-beep, halt, ......). I have not met that before and turned to Google for help. After some looking and trying (at some time I thought it is because a disc stuck in the drive), finally I found a few sources all point out that the 3-beep sound means "bad memory". The colleague then tried taking the two 1-GB RAM in and out to test and BINGO! The problem was caused by one single faulty RAM! So I will know what to do if any of my machine gives me that sound......
Update: One of my friends told me just now those beep sounds are called "beep code" and their meanings are dependent to different BIOS. A reference of Mac machines can be found here.
Update: Another reference in Wikipedia.
Update: One of my friends told me just now those beep sounds are called "beep code" and their meanings are dependent to different BIOS. A reference of Mac machines can be found here.
Update: Another reference in Wikipedia.
ラベル:
Macbook Pro,
Misc
Wednesday, October 13, 2010
Notes of differences between x86 and x64 on programming
Notes: For reference only, actual situation should be affected by CPU type, kernel, compiler, etc.
Data Type | Ubuntu x86 | Ubuntu x64 | Win32 | MacOS 10.6 | SunOS 5.10 | MIPS | iOS |
---|---|---|---|---|---|---|---|
char | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
short | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
int | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
long | 4 | 8 | 4 | 8 | 4 | 4 | 4 |
long int | 4 | 8 | 4 | 8 | 4 | 4 | 4 |
long long | 8 | 8 | 8 | 8 | 8 | 8 | 8 |
float | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
double | 8 | 8 | 8 | 8 | 8 | 8 | 8 |
long double | 12 | 16 | 8 | 16 | 16 | 8 | 8 |
pointer | 4 | 8 | 4 | 8 | 4 | 4 | 4 |
ラベル:
Programming
Subscribe to:
Posts (Atom)