#define mm_lock2(x) _mm_lock(x,2)
#define mm_unlock2(x) _mm_unlock(x,2)
#define mm_lock3(x) _mm_lock(x,3)
#define mm_unlock3(x) _mm_unlock(x,3)
#define mm_lock4(x) _mm_lock(x,4)
#define mm_unlock4(x) _mm_unlock(x,4)
#define MM_PROT_NONE 1
#define MM_PROT_READ 2
#define MM_PROT_WRITE 4
#define MM_PROT_EXEC 8
MM *mm_create(size_t size); // create mm by mmap
size_t mm_size(MM *mm);
void mm_destroy(MM *mm);
int _mm_lock(MM *mm, int num); // lock this mm
int _mm_unlock(MM *mm, int num);
int mm_protect(MM *mm, int mode); // protect the mm to avoid read|write?
size_t mm_available(MM *mm);
size_t mm_maxsize(MM *mm);
void *mm_malloc(MM *mm, size_t size);
void mm_free(MM *mm, void *p);
void *mm_malloc_nolock(MM *mm, size_t size);
void mm_free_nolock(MM *mm, void *p);
时间:2009-06-13 20:29
来源:chinaunix
作者:hightman
原文链接