Skip to content

Commit 7986d1f

Browse files
authored
Merge pull request #206 from toku-sa-n/add_enable_and_hlt
Rename `enable_interrupts_and_hlt` to `enable_and_hlt`
2 parents 7def2db + c8b4c3d commit 7986d1f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/instructions/interrupts.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ where
103103
/// x86_64::instructions::hlt(); // wait for the next interrupt
104104
/// }
105105
///
106-
/// // avoid this race by using `enable_interrupts_and_hlt`:
106+
/// // avoid this race by using `enable_and_hlt`:
107107
///
108108
/// x86_64::instructions::interrupts::disable();
109109
/// if nothing_to_do() {
110110
/// // <- no interrupts can occur here (interrupts are disabled)
111-
/// x86_64::instructions::interrupts::enable_interrupts_and_hlt();
111+
/// x86_64::instructions::interrupts::enable_and_hlt();
112112
/// }
113113
///
114114
/// ```
@@ -128,7 +128,7 @@ where
128128
/// See <http://lkml.iu.edu/hypermail/linux/kernel/1009.2/01406.html> for more
129129
/// information.
130130
#[inline]
131-
pub fn enable_interrupts_and_hlt() {
131+
pub fn enable_and_hlt() {
132132
#[cfg(feature = "inline_asm")]
133133
unsafe {
134134
asm!("sti; hlt", options(nomem, nostack));
@@ -139,6 +139,13 @@ pub fn enable_interrupts_and_hlt() {
139139
}
140140
}
141141

142+
/// Alias for [`enable_and_hlt`][enable_and_hlt] for backwards compatibility.
143+
#[inline]
144+
#[deprecated(note = "Use enable_and_hlt instead")]
145+
pub fn enable_interrupts_and_hlt() {
146+
enable_and_hlt();
147+
}
148+
142149
/// Cause a breakpoint exception by invoking the `int3` instruction.
143150
#[inline]
144151
pub fn int3() {

0 commit comments

Comments
 (0)