mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	Kernel: Use RefPtr instead of LockRefPtr for File and subclasses
This was mostly straightforward, as all the storage locations are guarded by some related mutex. The use of old-school associated mutexes instead of MutexProtected is unfortunate, but the process to modernize such code is ongoing.
This commit is contained in:
		
							parent
							
								
									61bb9103c2
								
							
						
					
					
						commit
						03cc45e5a2
					
				
					 20 changed files with 63 additions and 63 deletions
				
			
		|  | @ -38,9 +38,9 @@ MutexProtected<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port() | |||
|     return *s_map; | ||||
| } | ||||
| 
 | ||||
| LockRefPtr<UDPSocket> UDPSocket::from_port(u16 port) | ||||
| RefPtr<UDPSocket> UDPSocket::from_port(u16 port) | ||||
| { | ||||
|     return sockets_by_port().with_shared([&](auto const& table) -> LockRefPtr<UDPSocket> { | ||||
|     return sockets_by_port().with_shared([&](auto const& table) -> RefPtr<UDPSocket> { | ||||
|         auto it = table.find(port); | ||||
|         if (it == table.end()) | ||||
|             return {}; | ||||
|  | @ -60,9 +60,9 @@ UDPSocket::~UDPSocket() | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<UDPSocket>> UDPSocket::try_create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer) | ||||
| ErrorOr<NonnullRefPtr<UDPSocket>> UDPSocket::try_create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer) | ||||
| { | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) UDPSocket(protocol, move(receive_buffer))); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) UDPSocket(protocol, move(receive_buffer))); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<size_t> UDPSocket::protocol_size(ReadonlyBytes raw_ipv4_packet) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling