@@ -14,11 +14,15 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17+ use std:: sync:: Arc ;
18+
1719use hyperlight_host:: func:: { ParameterTuple , SupportedReturnType } ;
20+ // re-export the InterruptHandle trait as it's part of the public API
21+ pub use hyperlight_host:: hypervisor:: InterruptHandle ;
1822use hyperlight_host:: sandbox:: Callable ;
1923use hyperlight_host:: sandbox_state:: sandbox:: { DevolvableSandbox , Sandbox } ;
2024use hyperlight_host:: sandbox_state:: transition:: Noop ;
21- use hyperlight_host:: { MultiUseSandbox , Result , log_then_return} ;
25+ use hyperlight_host:: { MultiUseSandbox , Result , log_then_return, new_error } ;
2226
2327use super :: metrics:: METRIC_TOTAL_LOADED_WASM_SANDBOXES ;
2428use super :: wasm_sandbox:: WasmSandbox ;
@@ -72,6 +76,18 @@ impl LoadedWasmSandbox {
7276 metrics:: counter!( METRIC_TOTAL_LOADED_WASM_SANDBOXES ) . increment ( 1 ) ;
7377 Ok ( LoadedWasmSandbox { inner : Some ( inner) } )
7478 }
79+
80+ /// Get a handle to the interrupt handler for this sandbox,
81+ /// capable of interrupting guest execution.
82+ pub fn interrupt_handle ( & self ) -> Result < Arc < dyn InterruptHandle > > {
83+ if let Some ( inner) = & self . inner {
84+ Ok ( inner. interrupt_handle ( ) )
85+ } else {
86+ Err ( new_error ! (
87+ "WasmSandbox is None, cannot get interrupt handle"
88+ ) )
89+ }
90+ }
7591}
7692
7793impl Callable for LoadedWasmSandbox {
0 commit comments