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

@ -1290,6 +1290,28 @@ uint64 calculate_unique_id(size_t pool)
return HashKey::HashBytes(&(uid_pool[pool].key), sizeof(uid_pool[pool].key));
}
bool safe_write(int fd, const char* data, int len)
{
return true;
while ( len > 0 )
{
int n = write(fd, data, len);
if ( n < 0 )
{
if ( errno == EINTR )
continue;
return false;
}
data += n;
len -= n;
}
return true;
}
void out_of_memory(const char* where)
{
reporter->FatalError("out of memory in %s.\n", where);