Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
acc3ab4e
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
acc3ab4e
编写于
6月 06, 2022
作者:
M
Mara Bos
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make all {Mutex, Condvar, RwLock}::new #[inline].
上级
e70c60d3
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
21 addition
and
4 deletion
+21
-4
library/std/src/sync/condvar.rs
library/std/src/sync/condvar.rs
+2
-1
library/std/src/sync/mutex.rs
library/std/src/sync/mutex.rs
+2
-1
library/std/src/sync/poison.rs
library/std/src/sync/poison.rs
+1
-0
library/std/src/sync/rwlock.rs
library/std/src/sync/rwlock.rs
+2
-1
library/std/src/sys/itron/mutex.rs
library/std/src/sys/itron/mutex.rs
+1
-0
library/std/src/sys/solid/rwlock.rs
library/std/src/sys/solid/rwlock.rs
+1
-0
library/std/src/sys/unsupported/locks/condvar.rs
library/std/src/sys/unsupported/locks/condvar.rs
+1
-0
library/std/src/sys/unsupported/locks/mutex.rs
library/std/src/sys/unsupported/locks/mutex.rs
+1
-0
library/std/src/sys/unsupported/locks/rwlock.rs
library/std/src/sys/unsupported/locks/rwlock.rs
+1
-0
library/std/src/sys/windows/locks/condvar.rs
library/std/src/sys/windows/locks/condvar.rs
+1
-0
library/std/src/sys/windows/locks/mutex.rs
library/std/src/sys/windows/locks/mutex.rs
+1
-0
library/std/src/sys/windows/locks/rwlock.rs
library/std/src/sys/windows/locks/rwlock.rs
+1
-0
library/std/src/sys_common/condvar.rs
library/std/src/sys_common/condvar.rs
+2
-1
library/std/src/sys_common/mutex.rs
library/std/src/sys_common/mutex.rs
+2
-0
library/std/src/sys_common/rwlock.rs
library/std/src/sys_common/rwlock.rs
+2
-0
未找到文件。
library/std/src/sync/condvar.rs
浏览文件 @
acc3ab4e
...
...
@@ -123,7 +123,8 @@ impl Condvar {
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
#[must_use]
pub
fn
new
()
->
Condvar
{
#[inline]
pub
const
fn
new
()
->
Condvar
{
Condvar
{
inner
:
sys
::
Condvar
::
new
()
}
}
...
...
library/std/src/sync/mutex.rs
浏览文件 @
acc3ab4e
...
...
@@ -214,7 +214,8 @@ impl<T> Mutex<T> {
/// let mutex = Mutex::new(0);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
new
(
t
:
T
)
->
Mutex
<
T
>
{
#[inline]
pub
const
fn
new
(
t
:
T
)
->
Mutex
<
T
>
{
Mutex
{
inner
:
sys
::
MovableMutex
::
new
(),
poison
:
poison
::
Flag
::
new
(),
...
...
library/std/src/sync/poison.rs
浏览文件 @
acc3ab4e
...
...
@@ -19,6 +19,7 @@ pub struct Flag {
// all cases.
impl
Flag
{
#[inline]
pub
const
fn
new
()
->
Flag
{
Flag
{
failed
:
AtomicBool
::
new
(
false
)
}
}
...
...
library/std/src/sync/rwlock.rs
浏览文件 @
acc3ab4e
...
...
@@ -146,7 +146,8 @@ impl<T> RwLock<T> {
/// let lock = RwLock::new(5);
/// ```
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
fn
new
(
t
:
T
)
->
RwLock
<
T
>
{
#[inline]
pub
const
fn
new
(
t
:
T
)
->
RwLock
<
T
>
{
RwLock
{
inner
:
sys
::
MovableRwLock
::
new
(),
poison
:
poison
::
Flag
::
new
(),
...
...
library/std/src/sys/itron/mutex.rs
浏览文件 @
acc3ab4e
...
...
@@ -26,6 +26,7 @@ fn new_mtx() -> Result<abi::ID, ItronError> {
}
impl
Mutex
{
#[inline]
pub
const
fn
new
()
->
Mutex
{
Mutex
{
mtx
:
SpinIdOnceCell
::
new
()
}
}
...
...
library/std/src/sys/solid/rwlock.rs
浏览文件 @
acc3ab4e
...
...
@@ -23,6 +23,7 @@ fn new_rwl() -> Result<abi::ID, ItronError> {
}
impl
RwLock
{
#[inline]
pub
const
fn
new
()
->
RwLock
{
RwLock
{
rwl
:
SpinIdOnceCell
::
new
()
}
}
...
...
library/std/src/sys/unsupported/locks/condvar.rs
浏览文件 @
acc3ab4e
...
...
@@ -6,6 +6,7 @@ pub struct Condvar {}
pub
type
MovableCondvar
=
Condvar
;
impl
Condvar
{
#[inline]
pub
const
fn
new
()
->
Condvar
{
Condvar
{}
}
...
...
library/std/src/sys/unsupported/locks/mutex.rs
浏览文件 @
acc3ab4e
...
...
@@ -11,6 +11,7 @@ unsafe impl Send for Mutex {}
unsafe
impl
Sync
for
Mutex
{}
// no threads on this platform
impl
Mutex
{
#[inline]
pub
const
fn
new
()
->
Mutex
{
Mutex
{
locked
:
Cell
::
new
(
false
)
}
}
...
...
library/std/src/sys/unsupported/locks/rwlock.rs
浏览文件 @
acc3ab4e
...
...
@@ -11,6 +11,7 @@ unsafe impl Send for RwLock {}
unsafe
impl
Sync
for
RwLock
{}
// no threads on this platform
impl
RwLock
{
#[inline]
pub
const
fn
new
()
->
RwLock
{
RwLock
{
mode
:
Cell
::
new
(
0
)
}
}
...
...
library/std/src/sys/windows/locks/condvar.rs
浏览文件 @
acc3ab4e
...
...
@@ -14,6 +14,7 @@ unsafe impl Send for Condvar {}
unsafe
impl
Sync
for
Condvar
{}
impl
Condvar
{
#[inline]
pub
const
fn
new
()
->
Condvar
{
Condvar
{
inner
:
UnsafeCell
::
new
(
c
::
CONDITION_VARIABLE_INIT
)
}
}
...
...
library/std/src/sys/windows/locks/mutex.rs
浏览文件 @
acc3ab4e
...
...
@@ -33,6 +33,7 @@ pub unsafe fn raw(m: &Mutex) -> c::PSRWLOCK {
}
impl
Mutex
{
#[inline]
pub
const
fn
new
()
->
Mutex
{
Mutex
{
srwlock
:
UnsafeCell
::
new
(
c
::
SRWLOCK_INIT
)
}
}
...
...
library/std/src/sys/windows/locks/rwlock.rs
浏览文件 @
acc3ab4e
...
...
@@ -11,6 +11,7 @@ unsafe impl Send for RwLock {}
unsafe
impl
Sync
for
RwLock
{}
impl
RwLock
{
#[inline]
pub
const
fn
new
()
->
RwLock
{
RwLock
{
inner
:
UnsafeCell
::
new
(
c
::
SRWLOCK_INIT
)
}
}
...
...
library/std/src/sys_common/condvar.rs
浏览文件 @
acc3ab4e
...
...
@@ -14,7 +14,8 @@ pub struct Condvar {
impl
Condvar
{
/// Creates a new condition variable for use.
pub
fn
new
()
->
Self
{
#[inline]
pub
const
fn
new
()
->
Self
{
Self
{
inner
:
imp
::
MovableCondvar
::
new
(),
check
:
CondvarCheck
::
new
()
}
}
...
...
library/std/src/sys_common/mutex.rs
浏览文件 @
acc3ab4e
...
...
@@ -15,6 +15,7 @@ unsafe impl Sync for StaticMutex {}
impl
StaticMutex
{
/// Creates a new mutex for use.
#[inline]
pub
const
fn
new
()
->
Self
{
Self
(
imp
::
Mutex
::
new
())
}
...
...
@@ -60,6 +61,7 @@ unsafe impl Sync for MovableMutex {}
impl
MovableMutex
{
/// Creates a new mutex.
#[inline]
pub
fn
new
()
->
Self
{
Self
(
imp
::
MovableMutex
::
new
())
}
...
...
library/std/src/sys_common/rwlock.rs
浏览文件 @
acc3ab4e
...
...
@@ -10,6 +10,7 @@
impl
StaticRwLock
{
/// Creates a new rwlock for use.
#[inline]
pub
const
fn
new
()
->
Self
{
Self
(
imp
::
RwLock
::
new
())
}
...
...
@@ -73,6 +74,7 @@ fn drop(&mut self) {
impl
MovableRwLock
{
/// Creates a new reader-writer lock for use.
#[inline]
pub
fn
new
()
->
Self
{
Self
(
imp
::
MovableRwLock
::
new
())
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录