Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
eb0cf3a7
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,发现更多精彩内容 >>
提交
eb0cf3a7
编写于
9月 04, 2012
作者:
B
Brian Anderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
std: Remove struct ctors
上级
268850f6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
64 addition
and
10 deletion
+64
-10
src/libstd/arc.rs
src/libstd/arc.rs
+6
-1
src/libstd/c_vec.rs
src/libstd/c_vec.rs
+6
-1
src/libstd/net_tcp.rs
src/libstd/net_tcp.rs
+12
-2
src/libstd/sync.rs
src/libstd/sync.rs
+40
-6
未找到文件。
src/libstd/arc.rs
浏览文件 @
eb0cf3a7
...
...
@@ -223,13 +223,18 @@ fn check_poison(is_mutex: bool, failed: bool) {
#[doc(hidden)]
struct
PoisonOnFail
{
failed
:
&
mut
bool
;
new
(
failed
:
&
mut
bool
)
{
self
.failed
=
failed
;
}
drop
{
/* assert !*self.failed; -- might be false in case of cond.wait() */
if
task
::
failing
()
{
*
self
.failed
=
true
;
}
}
}
fn
PoisonOnFail
(
failed
:
&
r
/
mut
bool
)
->
PoisonOnFail
/&
r
{
PoisonOnFail
{
failed
:
failed
}
}
/****************************************************************************
* R/W lock protected ARC
****************************************************************************/
...
...
src/libstd/c_vec.rs
浏览文件 @
eb0cf3a7
...
...
@@ -44,7 +44,6 @@ enum CVec<T> {
struct
DtorRes
{
let
dtor
:
Option
<
fn
@
()
>
;
new
(
dtor
:
Option
<
fn
@
()
>
)
{
self
.dtor
=
dtor
;
}
drop
{
match
self
.dtor
{
option
::
None
=>
(),
...
...
@@ -53,6 +52,12 @@ struct DtorRes {
}
}
fn
DtorRes
(
dtor
:
Option
<
fn
@
()
>
)
->
DtorRes
{
DtorRes
{
dtor
:
dtor
}
}
/*
Section: Introduction forms
*/
...
...
src/libstd/net_tcp.rs
浏览文件 @
eb0cf3a7
...
...
@@ -40,7 +40,6 @@
*/
struct
TcpSocket
{
let
socket_data
:
@
TcpSocketData
;
new
(
socket_data
:
@
TcpSocketData
)
{
self
.socket_data
=
socket_data
;
}
drop
{
unsafe
{
tear_down_socket_data
(
self
.socket_data
)
...
...
@@ -48,6 +47,12 @@ struct TcpSocket {
}
}
fn
TcpSocket
(
socket_data
:
@
TcpSocketData
)
->
TcpSocket
{
TcpSocket
{
socket_data
:
socket_data
}
}
/**
* A buffered wrapper for `net::tcp::tcp_socket`
*
...
...
@@ -56,7 +61,12 @@ struct TcpSocket {
*/
struct
TcpSocketBuf
{
let
data
:
@
TcpBufferedSocketData
;
new
(
data
:
@
TcpBufferedSocketData
)
{
self
.data
=
data
;
}
}
fn
TcpSocketBuf
(
data
:
@
TcpBufferedSocketData
)
->
TcpSocketBuf
{
TcpSocketBuf
{
data
:
data
}
}
/// Contains raw, string-based, error information returned from libuv
...
...
src/libstd/sync.rs
浏览文件 @
eb0cf3a7
...
...
@@ -154,16 +154,28 @@ fn access<U>(blk: fn() -> U) -> U {
#[doc(hidden)]
struct
SemRelease
{
sem
:
&
Sem
<
()
>
;
new
(
sem
:
&
Sem
<
()
>
)
{
self
.sem
=
sem
;
}
drop
{
self
.sem
.release
();
}
}
fn
SemRelease
(
sem
:
&
r
/
Sem
<
()
>
)
->
SemRelease
/&
r
{
SemRelease
{
sem
:
sem
}
}
#[doc(hidden)]
struct
SemAndSignalRelease
{
sem
:
&
Sem
<~
[
mut
Waitqueue
]
>
;
new
(
sem
:
&
Sem
<~
[
mut
Waitqueue
]
>
)
{
self
.sem
=
sem
;
}
drop
{
self
.sem
.release
();
}
}
fn
SemAndSignalRelease
(
sem
:
&
r
/
Sem
<~
[
mut
Waitqueue
]
>
)
->
SemAndSignalRelease
/&
r
{
SemAndSignalRelease
{
sem
:
sem
}
}
/// A mechanism for atomic-unlock-and-deschedule blocking and signalling.
struct
Condvar
{
priv
sem
:
&
Sem
<~
[
mut
Waitqueue
]
>
;
drop
{
}
}
...
...
@@ -234,7 +246,6 @@ fn wait_on(condvar_id: uint) {
// bounded in when it gets released, this shouldn't hang forever.
struct
SemAndSignalReacquire
{
sem
:
&
Sem
<~
[
mut
Waitqueue
]
>
;
new
(
sem
:
&
Sem
<~
[
mut
Waitqueue
]
>
)
{
self
.sem
=
sem
;
}
drop
unsafe
{
// Needs to succeed, instead of itself dying.
do
task
::
unkillable
{
...
...
@@ -242,6 +253,14 @@ struct SemAndSignalReacquire {
}
}
}
fn
SemAndSignalReacquire
(
sem
:
&
r
/
Sem
<~
[
mut
Waitqueue
]
>
)
->
SemAndSignalReacquire
/&
r
{
SemAndSignalReacquire
{
sem
:
sem
}
}
}
/// Wake up a blocked task. Returns false if there was no blocked task.
...
...
@@ -567,7 +586,6 @@ fn downgrade(+token: RWlockWriteMode/&a) -> RWlockReadMode/&a {
#[doc(hidden)]
struct
RWlockReleaseRead
{
lock
:
&
RWlock
;
new
(
lock
:
&
RWlock
)
{
self
.lock
=
lock
;
}
drop
unsafe
{
do
task
::
unkillable
{
let
mut
last_reader
=
false
;
...
...
@@ -587,11 +605,16 @@ struct RWlockReleaseRead {
}
}
fn
RWlockReleaseRead
(
lock
:
&
r
/
RWlock
)
->
RWlockReleaseRead
/&
r
{
RWlockReleaseRead
{
lock
:
lock
}
}
// FIXME(#3136) should go inside of downgrade()
#[doc(hidden)]
struct
RWlockReleaseDowngrade
{
lock
:
&
RWlock
;
new
(
lock
:
&
RWlock
)
{
self
.lock
=
lock
;
}
drop
unsafe
{
do
task
::
unkillable
{
let
mut
writer_or_last_reader
=
false
;
...
...
@@ -618,6 +641,12 @@ struct RWlockReleaseDowngrade {
}
}
fn
RWlockReleaseDowngrade
(
lock
:
&
r
/
RWlock
)
->
RWlockReleaseDowngrade
/&
r
{
RWlockReleaseDowngrade
{
lock
:
lock
}
}
/// The "write permission" token used for rwlock.write_downgrade().
struct
RWlockWriteMode
{
/* priv */
lock
:
&
RWlock
;
drop
{
}
}
/// The "read permission" token used for rwlock.write_downgrade().
...
...
@@ -929,9 +958,14 @@ fn test_mutex_killed_broadcast() {
}
struct
SendOnFailure
{
c
:
pipes
::
Chan
<
()
>
;
new
(
+
c
:
pipes
::
Chan
<
()
>
)
{
self
.c
=
c
;
}
drop
{
self
.c
.send
(());
}
}
fn
SendOnFailure
(
+
c
:
pipes
::
Chan
<
()
>
)
->
SendOnFailure
{
SendOnFailure
{
c
:
c
}
}
}
#[test]
fn
test_mutex_cond_signal_on_0
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录