Further reworking the thread API.

This commit is contained in:
Robin Sommer 2012-07-17 17:09:49 -07:00
parent f7a6407ab1
commit f6b883bafc
7 changed files with 36 additions and 13 deletions

View file

@ -289,6 +289,11 @@ inline size_t pad_size(size_t size)
#define padded_sizeof(x) (pad_size(sizeof(x)))
// Like write() but handles interrupted system calls by restarting. Returns
// true if the write was successful, otherwise sets errno. This function is
// thread-safe as long as no two threads write to the same descriptor.
extern bool safe_write(int fd, const char* data, int len);
extern void out_of_memory(const char* where);
inline void* safe_realloc(void* ptr, size_t size)
@ -338,4 +343,5 @@ inline int safe_vsnprintf(char* str, size_t size, const char* format, va_list al
// handed out by malloc.
extern void get_memory_usage(unsigned int* total,
unsigned int* malloced);
#endif