mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 23:28:29 +00:00
vfs: notify all blockers in fs adapter
if requested so ( by _post_signal_hook.arm(nullptr) ) Issue #2664
This commit is contained in:
committed by
Norman Feske
parent
f05c4df36a
commit
bfd24de4ad
@ -361,7 +361,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
Io_response_handler &_io_handler;
|
Io_response_handler &_io_handler;
|
||||||
List<Vfs_handle::Context> _context_list { };
|
List<Vfs_handle::Context> _context_list { };
|
||||||
Lock _list_lock { };
|
Lock _list_lock { };
|
||||||
bool _null_context_armed { false };
|
bool _notify_all { false };
|
||||||
|
|
||||||
Post_signal_hook(Genode::Entrypoint &ep,
|
Post_signal_hook(Genode::Entrypoint &ep,
|
||||||
Io_response_handler &io_handler)
|
Io_response_handler &io_handler)
|
||||||
@ -370,16 +370,9 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
void arm(Vfs_handle::Context *context)
|
void arm(Vfs_handle::Context *context)
|
||||||
{
|
{
|
||||||
if (!context) {
|
if (!context) {
|
||||||
|
Lock::Guard list_guard(_list_lock);
|
||||||
if (!_null_context_armed) {
|
_notify_all = true;
|
||||||
_null_context_armed = true;
|
} else {
|
||||||
_ep.schedule_post_signal_hook(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Lock::Guard list_guard(_list_lock);
|
Lock::Guard list_guard(_list_lock);
|
||||||
|
|
||||||
for (Vfs_handle::Context *list_context = _context_list.first();
|
for (Vfs_handle::Context *list_context = _context_list.first();
|
||||||
@ -402,24 +395,26 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
{
|
{
|
||||||
Vfs_handle::Context *context = nullptr;
|
Vfs_handle::Context *context = nullptr;
|
||||||
|
|
||||||
for (;;) {
|
do {
|
||||||
|
bool notify_all = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
Lock::Guard list_guard(_list_lock);
|
Lock::Guard list_guard(_list_lock);
|
||||||
|
|
||||||
context = _context_list.first();
|
context = _context_list.first();
|
||||||
_context_list.remove(context);
|
_context_list.remove(context);
|
||||||
|
|
||||||
|
if (!context && _notify_all) {
|
||||||
|
notify_all = true;
|
||||||
|
_notify_all = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context) {
|
if (context || notify_all)
|
||||||
if (!_null_context_armed)
|
_io_handler.handle_io_response(context);
|
||||||
break;
|
|
||||||
else
|
|
||||||
_null_context_armed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_io_handler.handle_io_response(context);
|
/* done if no contexts and all notified */
|
||||||
}
|
} while (context);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user