mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:27:35 +00:00
Kernel: Stop using LockRefPtrs in the Jail code
Each Jail object within the list is already protected by the global list spinlock, therefore there's no need for using LockRefPtrs at all.
This commit is contained in:
parent
e8510b6415
commit
93fceb1890
2 changed files with 8 additions and 9 deletions
|
@ -24,11 +24,11 @@ NonnullRefPtr<ProcessList> Jail::process_list()
|
|||
return m_process_list;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullLockRefPtr<Jail>> Jail::create(NonnullOwnPtr<KString> name)
|
||||
ErrorOr<NonnullRefPtr<Jail>> Jail::create(NonnullOwnPtr<KString> name)
|
||||
{
|
||||
return s_all_instances->with([&](auto& list) -> ErrorOr<NonnullLockRefPtr<Jail>> {
|
||||
return s_all_instances->with([&](auto& list) -> ErrorOr<NonnullRefPtr<Jail>> {
|
||||
auto process_list = TRY(ProcessList::create());
|
||||
auto jail = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) Jail(move(name), generate_jail_id(), move(process_list))));
|
||||
auto jail = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Jail(move(name), generate_jail_id(), move(process_list))));
|
||||
list.append(jail);
|
||||
return jail;
|
||||
});
|
||||
|
@ -50,9 +50,9 @@ ErrorOr<void> Jail::for_each_when_process_is_not_jailed(Function<ErrorOr<void>(J
|
|||
});
|
||||
}
|
||||
|
||||
LockRefPtr<Jail> Jail::find_by_index(JailIndex index)
|
||||
RefPtr<Jail> Jail::find_by_index(JailIndex index)
|
||||
{
|
||||
return s_all_instances->with([&](auto& list) -> LockRefPtr<Jail> {
|
||||
return s_all_instances->with([&](auto& list) -> RefPtr<Jail> {
|
||||
for (auto& jail : list) {
|
||||
if (jail.index() == index)
|
||||
return jail;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue