This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static abstract class Pool<T> { | |
| private final Deque<T> pool; | |
| Pool(int initialSize) { | |
| pool = new ArrayDeque<T>(initialSize); | |
| for (int i = 0; i < initialSize; i++) { | |
| pool.addLast(newObject()); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void enableStrictMode() { | |
| if (PlatformUtils.hasGingerbread()) { | |
| StrictMode.ThreadPolicy.Builder threadPolicyBuilder = | |
| new StrictMode.ThreadPolicy.Builder() | |
| .detectAll() | |
| .penaltyLog(); | |
| StrictMode.VmPolicy.Builder vmPolicyBuilder = | |
| new StrictMode.VmPolicy.Builder() | |
| .detectAll() | |
| .penaltyLog(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int find_pid_of(const char *process_name) | |
| { | |
| int id; | |
| pid_t pid = -1; | |
| DIR* dir; | |
| FILE *fp; | |
| char filename[32]; | |
| char cmdline[256]; | |
| struct dirent * entry; |
OlderNewer