153 |
* Locks the memory so it will not be swapped out by the operating system. |
* Locks the memory so it will not be swapped out by the operating system. |
154 |
*/ |
*/ |
155 |
int Thread::LockMemory() { |
int Thread::LockMemory() { |
156 |
|
#if !defined(__APPLE__) |
157 |
if (!bLockedMemory) return 0; |
if (!bLockedMemory) return 0; |
158 |
if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) { |
if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) { |
159 |
perror("Thread: WARNING, can't mlockall() memory!"); |
perror("Thread: WARNING, can't mlockall() memory!"); |
160 |
return -1; |
return -1; |
161 |
} |
} |
162 |
|
#endif |
163 |
return 0; |
return 0; |
164 |
} |
} |
165 |
|
|