mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Further reworking the thread API.
This commit is contained in:
parent
f7a6407ab1
commit
f6b883bafc
7 changed files with 36 additions and 13 deletions
22
src/util.cc
22
src/util.cc
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue