mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-20 08:03:56 +00:00
Linux: Add 'Platform_thread' destructor
This commit is contained in:
@ -60,6 +60,8 @@ class Genode::Socket_descriptor_registry
|
||||
Entry(int fd, int global_id) : fd(fd), global_id(global_id) { }
|
||||
|
||||
bool is_free() const { return fd == -1; }
|
||||
|
||||
void mark_as_free() { fd = -1; }
|
||||
};
|
||||
|
||||
Entry _entries[MAX_FDS];
|
||||
@ -75,6 +77,15 @@ class Genode::Socket_descriptor_registry
|
||||
throw Limit_reached();
|
||||
}
|
||||
|
||||
Entry &_find_entry_by_fd(int fd)
|
||||
{
|
||||
for (unsigned i = 0; i < MAX_FDS; i++)
|
||||
if (_entries[i].fd == fd)
|
||||
return _entries[i];
|
||||
|
||||
throw Limit_reached();
|
||||
}
|
||||
|
||||
bool _is_registered(int global_id) const
|
||||
{
|
||||
for (unsigned i = 0; i < MAX_FDS; i++)
|
||||
@ -112,6 +123,13 @@ class Genode::Socket_descriptor_registry
|
||||
entry = Entry(sd, global_id);
|
||||
}
|
||||
|
||||
void disassociate(int sd)
|
||||
{
|
||||
Genode::Lock::Guard guard(_lock);
|
||||
|
||||
_find_entry_by_fd(sd).mark_as_free();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup file descriptor that belongs to specified global ID
|
||||
*
|
||||
|
Reference in New Issue
Block a user