mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:32:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			566 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			566 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Tom <tomut@yahoo.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/BitCast.h>
 | |
| #include <AK/Function.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| struct DeferredCallEntry {
 | |
|     using HandlerFunction = Function<void()>;
 | |
| 
 | |
|     DeferredCallEntry* next;
 | |
|     alignas(HandlerFunction) u8 handler_storage[sizeof(HandlerFunction)];
 | |
|     bool was_allocated;
 | |
| 
 | |
|     HandlerFunction& handler_value()
 | |
|     {
 | |
|         return *bit_cast<HandlerFunction*>(&handler_storage);
 | |
|     }
 | |
| 
 | |
|     void invoke_handler()
 | |
|     {
 | |
|         handler_value()();
 | |
|     }
 | |
| };
 | |
| 
 | |
| }
 | 
