Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
5c78e183
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
大约 1 年 前同步成功
通知
9
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5c78e183
编写于
6月 21, 2015
作者:
R
Richard Levitte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup mttest.c : modernise the threads setup
Reviewed-by:
N
Rich Salz
<
rsalz@openssl.org
>
上级
a3f92865
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
50 deletion
+41
-50
crypto/threads/mttest.c
crypto/threads/mttest.c
+41
-50
未找到文件。
crypto/threads/mttest.c
浏览文件 @
5c78e183
...
...
@@ -111,18 +111,18 @@ void thread_setup(void);
void
thread_cleanup
(
void
);
void
do_threads
(
SSL_CTX
*
s_ctx
,
SSL_CTX
*
c_ctx
);
void
irix_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
);
void
solaris_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
);
void
win32_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
);
void
pthreads_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
);
void
netware_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
);
void
irix_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
);
void
solaris_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
);
void
win32_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
);
void
pthreads_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
);
void
netware_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
);
void
beos_locking_callback
(
int
mode
,
int
type
,
const
char
*
file
,
int
line
);
unsigned
long
irix_thread_id
(
vo
id
);
unsigned
long
solaris_thread_id
(
vo
id
);
unsigned
long
pthreads_thread_id
(
vo
id
);
unsigned
long
netware_thread_id
(
vo
id
);
unsigned
long
beos_thread_id
(
vo
id
);
void
irix_thread_id
(
CRYPTO_THREADID
*
t
id
);
void
solaris_thread_id
(
CRYPTO_THREADID
*
t
id
);
void
pthreads_thread_id
(
CRYPTO_THREADID
*
t
id
);
void
netware_thread_id
(
CRYPTO_THREADID
*
t
id
);
void
beos_thread_id
(
CRYPTO_THREADID
*
t
id
);
#if defined(OPENSSL_SYS_NETWARE)
static
MPKMutex
*
lock_cs
;
...
...
@@ -352,6 +352,7 @@ int ndoit(SSL_CTX *ssl_ctx[2])
int
i
;
int
ret
;
char
*
ctx
[
4
];
CRYPTO_THREADID
thread_id
;
ctx
[
0
]
=
(
char
*
)
ssl_ctx
[
0
];
ctx
[
1
]
=
(
char
*
)
ssl_ctx
[
1
];
...
...
@@ -364,22 +365,24 @@ int ndoit(SSL_CTX *ssl_ctx[2])
ctx
[
3
]
=
NULL
;
}
fprintf
(
stdout
,
"started thread %lu
\n
"
,
CRYPTO_thread_id
());
CRYPTO_THREADID_current
(
&
thread_id
);
BIO_printf
(
bio_stdout
,
"started thread %lu
\n
"
,
CRYPTO_THREADID_hash
(
&
thread_id
));
for
(
i
=
0
;
i
<
number_of_loops
;
i
++
)
{
/*-
fprintf(std
err,"%4d %2d ctx->ref (%3d,%3d)\n",
CRYPTO_thread_id(
),i,
ssl_ctx[0]->references,
ssl_ctx[1]->references); */
/* pthread_delay_np(&tm); */
/*-
BIO_printf(bio_
err,"%4d %2d ctx->ref (%3d,%3d)\n",
CRYPTO_THREADID_hash(&thread_id
),i,
ssl_ctx[0]->references,
ssl_ctx[1]->references); */
/* pthread_delay_np(&tm); */
ret
=
doit
(
ctx
);
if
(
ret
!=
0
)
{
fprintf
(
stdout
,
"error[%d] %lu - %d
\n
"
,
i
,
CRYPTO_thread_id
(
),
ret
);
BIO_printf
(
bio_
stdout
,
"error[%d] %lu - %d
\n
"
,
i
,
CRYPTO_THREADID_hash
(
&
thread_id
),
ret
);
return
(
ret
);
}
}
fprintf
(
stdout
,
"DONE %lu
\n
"
,
CRYPTO_thread_id
(
));
BIO_printf
(
bio_stdout
,
"DONE %lu
\n
"
,
CRYPTO_THREADID_hash
(
&
thread_id
));
if
(
reconnect
)
{
SSL_free
((
SSL
*
)
ctx
[
2
]);
SSL_free
((
SSL
*
)
ctx
[
3
]);
...
...
@@ -668,7 +671,7 @@ void thread_cleanup(void)
OPENSSL_free
(
lock_cs
);
}
void
win32_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
)
void
win32_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
)
{
if
(
mode
&
CRYPTO_LOCK
)
{
WaitForSingleObject
(
lock_cs
[
type
],
INFINITE
);
...
...
@@ -748,8 +751,8 @@ void thread_setup(void)
mutex_init
(
&
(
lock_cs
[
i
]),
USYNC_THREAD
,
NULL
);
}
CRYPTO_set_id_callback
(
(
unsigned
long
(
*
)())
solaris_thread_id
);
CRYPTO_set_locking_callback
(
(
void
(
*
)())
solaris_locking_callback
);
CRYPTO_set_id_callback
(
solaris_thread_id
);
CRYPTO_set_locking_callback
(
solaris_locking_callback
);
}
void
thread_cleanup
(
void
)
...
...
@@ -772,7 +775,7 @@ void thread_cleanup(void)
}
void
solaris_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
)
void
solaris_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
)
{
if
(
mode
&
CRYPTO_LOCK
)
{
mutex_lock
(
&
(
lock_cs
[
type
]));
...
...
@@ -806,12 +809,9 @@ void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
s_ctx
->
references
,
c_ctx
->
references
);
}
unsigned
long
solaris_thread_id
(
vo
id
)
void
solaris_thread_id
(
CRYPTO_THREADID
*
t
id
)
{
unsigned
long
ret
;
ret
=
(
unsigned
long
)
thr_self
();
return
(
ret
);
CRYPTO_THREADID_set_numeric
((
unsigned
long
)
thr_self
());
}
#endif
/* SOLARIS */
...
...
@@ -840,8 +840,8 @@ void thread_setup(void)
lock_cs
[
i
]
=
usnewsema
(
arena
,
1
);
}
CRYPTO_set_id_callback
(
(
unsigned
long
(
*
)())
irix_thread_id
);
CRYPTO_set_locking_callback
(
(
void
(
*
)())
irix_locking_callback
);
CRYPTO_set_id_callback
(
irix_thread_id
);
CRYPTO_set_locking_callback
(
irix_locking_callback
);
}
void
thread_cleanup
(
void
)
...
...
@@ -859,7 +859,7 @@ void thread_cleanup(void)
OPENSSL_free
(
lock_cs
);
}
void
irix_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
)
void
irix_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
)
{
if
(
mode
&
CRYPTO_LOCK
)
{
printf
(
"lock %d
\n
"
,
type
);
...
...
@@ -895,10 +895,7 @@ void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
unsigned
long
irix_thread_id
(
void
)
{
unsigned
long
ret
;
ret
=
(
unsigned
long
)
getpid
();
return
(
ret
);
CRYPTO_THREADID_set_numeric
((
unsigned
long
)
getpid
());
}
#endif
/* IRIX */
...
...
@@ -918,8 +915,8 @@ void thread_setup(void)
pthread_mutex_init
(
&
(
lock_cs
[
i
]),
NULL
);
}
CRYPTO_
set_id_callback
((
unsigned
long
(
*
)())
pthreads_thread_id
);
CRYPTO_set_locking_callback
(
(
void
(
*
)())
pthreads_locking_callback
);
CRYPTO_
THREADID_set_callback
(
pthreads_thread_id
);
CRYPTO_set_locking_callback
(
pthreads_locking_callback
);
}
void
thread_cleanup
(
void
)
...
...
@@ -938,7 +935,7 @@ void thread_cleanup(void)
fprintf
(
stderr
,
"done cleanup
\n
"
);
}
void
pthreads_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
)
void
pthreads_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
)
{
if
(
mode
&
CRYPTO_LOCK
)
{
pthread_mutex_lock
(
&
(
lock_cs
[
type
]));
...
...
@@ -974,12 +971,9 @@ void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
s_ctx
->
references
,
c_ctx
->
references
);
}
unsigned
long
pthreads_thread_id
(
vo
id
)
void
pthreads_thread_id
(
CRYPTO_THREADID
*
t
id
)
{
unsigned
long
ret
;
ret
=
(
unsigned
long
)
pthread_self
();
return
(
ret
);
CRYPTO_THREADID_set_numeric
(
tid
,
(
unsigned
long
)
pthread_self
());
}
#endif
/* PTHREADS */
...
...
@@ -999,8 +993,8 @@ void thread_setup(void)
ThreadSem
=
MPKSemaphoreAlloc
(
"OpenSSL mttest semaphore"
,
0
);
CRYPTO_set_id_callback
(
(
unsigned
long
(
*
)())
netware_thread_id
);
CRYPTO_set_locking_callback
(
(
void
(
*
)())
netware_locking_callback
);
CRYPTO_set_id_callback
(
netware_thread_id
);
CRYPTO_set_locking_callback
(
netware_locking_callback
);
}
void
thread_cleanup
(
void
)
...
...
@@ -1023,7 +1017,7 @@ void thread_cleanup(void)
fprintf
(
stdout
,
"done cleanup
\n
"
);
}
void
netware_locking_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
)
void
netware_locking_callback
(
int
mode
,
int
type
,
c
onst
c
har
*
file
,
int
line
)
{
if
(
mode
&
CRYPTO_LOCK
)
{
MPKMutexLock
(
lock_cs
[
type
]);
...
...
@@ -1057,9 +1051,6 @@ void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
unsigned
long
netware_thread_id
(
void
)
{
unsigned
long
ret
;
ret
=
(
unsigned
long
)
GetThreadID
();
return
(
ret
);
CRYPTO_THREADID_set_numeric
((
unsigned
long
)
GetThreadID
());
}
#endif
/* NETWARE */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录