Skip to main content

KillDropTable

Struct KillDropTable 

Source
pub struct KillDropTable {
    ptr: [[AtomicUsize; 32]; 16],
    drop_fn: [[AtomicUsize; 32]; 16],
    seq: [[AtomicU32; 32]; 16],
    next_seq: [AtomicU32; 16],
}
Expand description

欄の表。window_mgr に 1 個だけ置く。

Fields§

§ptr: [[AtomicUsize; 32]; 16]

箱の番地(0 は空き)。

§drop_fn: [[AtomicUsize; 32]; 16]

箱を解放する関数(unsafe fn(*mut u8) を数にした物)。

§seq: [[AtomicU32; 32]; 16]

作った順の番号(解放は大きい方から)。

§next_seq: [AtomicU32; 16]

行ごとの次の番号。

Implementations§

Source§

impl KillDropTable

Source

pub const fn new() -> Self

Source

fn register(&self, row: usize, p: usize, f: unsafe fn(*mut u8)) -> Option<usize>

行 row の空き欄に箱 p を書く。書いた欄の番号を返す(行が無い・欄が埋まっていれば None)。

Source

fn release(&self, row: usize, e: usize, p: usize) -> bool

欄 (row, e) が箱 p を持っていれば空けて true(呼び出し元が箱を解放する)。 既に空いている(止めるときに解放済み)なら false。

Source

pub fn reset_row(&self, row: usize)

行 row の欄を、解放せずに全部空ける(新しいアプリのスレッドが行を使い始めるとき。前の持ち主の 消し忘れの欄を、後で誤って解放しないため)。

Source

pub fn live_in_row(&self, row: usize) -> usize

行 row の使っている欄の数。

Source

pub unsafe fn drain(&self, row: usize) -> usize

行 row に残っている箱を、作った順の逆に全部解放する。解放した数を返す。

§Safety

行 row の持ち主のスレッドの上で、そのスレッドが二度と再開しないと決まってから呼ぶこと (スタックの上の KillOwned が後で箱に触らないこと)。箱の中身のデストラクタが取る錠は、 呼ぶ前に外しておくこと。

Trait Implementations§

Source§

impl Default for KillDropTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.