Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
函数简介
|
327
函数简介
并没有被声明为
volatile
),那么,它们的值在调用
longjmp()
的语句执行后,会处于
不确定状态。
setjmp()
的返回值用来指示:程序到达这个执行点是因为原来的
setjmp()
调
用,还是因
为
longjmp()
调用。如果
setjmp()
返回
0
,那么属于前一种情况;如果
setjmp()
返回其他
值,那么属于后一种情况。如果调用
longjmp()
时
的第二个参数(也就是被请求的返回
值)是
0
,在对应的
setjmp()
调
用后,它会被
1
取代作为返回值。
17.14 多线程(C11)
第
14
章详细介绍了
C
语言多线程编程及其应用,它是
C11
新增的特性。本节所列的表格简
单展示了
C
语言多线程库概貌。注意,对于多线程和原子操作的支持是可选的。如果不
支持多线程或者原子操作,一个遵循
C11
标准的实现版本将会定义与之对应的宏
__STDC_
NO_THREADS__
或者宏
__STDC_NO_ATOMICS__
。
17.14.1 线程函数
线程库提供了函数以支持以下几种任务:
•
管理线程
•
使用互斥对象同步线程执行
•
使用条件变量,以用于线程间的通信
•
线程存储
相应地,多线程函数名称以
thrd_
、
mtx_
、
cnd_
或
tss_
作
为它们的前缀。唯一一个例外
是函数
call_once()
(请见表
17-28
)。所有这些函数均声明在头文件
threads.h
中。
表17-28:初始化函数
目的 函数
调用一个函数一次
call_once()
call_once()
确保了通过参数指示的函数仅在首次调用时执行。例如,初始化在几个线 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207