30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A signal may be handled by:<br />

• Default handling (SIG_DFL); the signal is treated as a fatal error and<br />

execution<br />

stops<br />

• Ignoring the signal (SIG_IGN); the signal is ignored and control is returned to<br />

the user application<br />

• Handling the signal with a function designated via signal.<br />

By default all signals are handled by the default handler, which is identified by<br />

SIG_DFL.<br />

The type sig_atomic_tis an integer type that the program access atomically.<br />

When<br />

this type is used with the keyword volatile, the signal handler can share the data<br />

objects with the rest of the program.<br />

sig_atomic_t<br />

Description: A type used by a signal handler<br />

Include: <br />

Prototype: typedef int sig_atomic_t;<br />

SIG_DFL<br />

Description: Used as the second argument and/or the return value for signalto<br />

specify that the default handler should be used for a specific signal.<br />

Include: <br />

SIG_ERR<br />

Description: Used as the return value for signalwhen it cannot complete a<br />

request due to an error.<br />

Include: <br />

SIG_IGN<br />

Description: Used as the second argument and/or the return value for signalto<br />

specify that the signalshould be ignored.<br />

Include: <br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

Mô tả: Tín hiệu truy cập không hợp lệ để lưu trữ.<br />

Bao gồm:<br />

Prototype: # define SIGSEGV<br />

Bình luận: SIGSEGVis sử dụng như một tham số cho raiseand / hoặc tín<br />

hiệu. Khi<br />

được sử dụng, hành vi mặc định là in một yêu cầu lưu trữ không hợp lệ<br />

thông báo và chấm dứt chương trình gọi điện thoại. Điều này có thể được ghi đ<br />

bởi<br />

một chức năng người dùng định nghĩa các hành động xử lý tín hiệu. Xem<br />

signalfor<br />

một ví dụ về một người dùng xác định chức năng.<br />

Ví dụ: # include / * Cho tăng lương, SIGSEGV * /<br />

# include / * Cho printf * /<br />

int main (void)<br />

{<br />

nâng cao (SIGSEGV);<br />

printf ("Chương trình không bao giờ đạt ở đây.");<br />

}<br />

Đầu ra:<br />

SEGV<br />

Giải thích:<br />

SEGV viết tắt của "truy cập lưu trữ không hợp lệ".<br />

SIGTERM<br />

Mô tả: Tín hiệu yêu cầu chấm dứt<br />

Bao gồm:<br />

Prototype: # define SIGTERM<br />

Bình luận: SIGTERMis sử dụng như một tham số cho raiseand / hoặc tín<br />

hiệu. Khi<br />

được sử dụng, hành vi mặc định là in một thông báo yêu cầu chấm dứt<br />

và chấm dứt chương trình gọi điện thoại. Điều này có thể được ghi đè bởi một<br />

người dùng<br />

chức năng xác định các hành động xử lý tín hiệu. Xem signalfor một<br />

ví dụ về một người dùng xác định chức năng.<br />

Ví dụ: # include / * Cho tăng lương, SIGTERM * /<br />

DS51456B-page 216<br />

SIGABRT<br />

2004 Microchip Technology Inc.<br />

# include / * Cho printf * /<br />

int main (void)<br />

Description: Name for the abnormal termination signal.<br />

Include: <br />

Prototype: #define SIGABRT<br />

Remarks: SIGABRTrepresents an abnormal termination signal and is used in<br />

conjunction with raiseor signal. The default raisebehavior<br />

(action identified by SIG_DFL) is to output to the standard error stream:<br />

{<br />

nâng cao (SIGTERM);<br />

printf ("Chương trình không bao giờ đạt ở đây.");<br />

}<br />

Đầu ra:<br />

HẠN

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!