Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
LINUX系統程式設計 第二版
by
Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from
LINUX系統程式設計 第二版
行程管理
|
159
嚴格來說,所有的
vfork()
實作幾乎都有瑕疵:考慮
exec
呼叫失敗的情況!此狀況下,
父行程將無限期暫停,除非子行程指出該怎麼辦,或是直到子行程結束執行。
終止一個行程
POSIX
和
C89
定義了一個標準函式,可用於終止當前行程:
#include <stdlib.h>
void exit (int status);
exit()
呼叫會進行一些基本的
shutdown
(停工)步驟,然後指示核心終止行程。此函
式無法傳回錯誤—事實上,它絕不會傳回任何值。因此,任何指令若跟在
exit()
呼叫之
後,不會有任何作用。
其中,
status
參數用於表示行程的結束狀態。其他的程式—及
shell
上的用戶—可以檢
查此值。特別是,
status & 0377
會被傳回給父行程。本章稍後會檢視此傳回值。
EXIT_SUCCESS
與
EXIT_FAILURE
被定義成可移植的方式,以表示成功和失敗的狀態。在
Linux
上,
0
通常表示成功;非零值,例如
1
或
-1
,則表示失敗。
因此,要表示成功的結束,就這麼簡單:
exit (EXIT_SUCCESS);
終止行程之前,
C
程式庫會依序進行下面的
shutdown
步驟:
1.
叫用以
atexit()
或
on_exit()
註冊的任何函式;按照與註冊相反的順序。(本章稍號
會討論這些函式。)
2.
出清(
flush
)所有已開啟的標準
I/O
串流(見第
3
章
)。
3.
移除任何由
tmpfile()
函式所建立的暫時檔案。
這些步驟完成了行程在用戶空間中需要進行的所有工作,所以 ...
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.
Start your free trial
You might also like
優雅的SciPy|Python科學研究的美學
Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
成為卓越程式設計師的38項必修法則
Pete Goodliffe
深入理解運算原理|從簡單的機器到無所不能的程式
Tom Stuart
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
Publisher Resources
ISBN: 9789862769812