<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>
<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">
<p class="details" style="font-style: italic; color: #737278;">
<a href="https://gitlab.rtems.org/yang.zhang">yang zhang</a> created an issue: <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5181">#5181</a>
</p>
<div class="md" style="position: relative; z-index: 1; color: #28272d; word-wrap: break-word;">
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 0 0 16px;" align="initial">
<a href="#summary" aria-hidden="true" class="anchor" id="user-content-summary" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Summary</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">I use a sample code in man pthread_cancel to test pthread_cancle it rtems, but it can't work.</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#steps-to-reproduce" aria-hidden="true" class="anchor" id="user-content-steps-to-reproduce" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Steps to reproduce</h2>
<ol dir="auto" style="text-align: initial; margin: 0 0 16px; padding: 0;">
<li style="margin-top: 0; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">I reusing posix testcases -- psxcancel</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Modify in by sample code in man pthread_cancel</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Check the output log, it should be as below:
thread_func(): started; cancellation disabled
main(): sending cancellation request
thread_func(): about to enable cancellation
main(): thread was canceled</li>
</ol>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">But actually, it's as below:
thread_func(): started; cancellation disabled
main(): sending cancellation request
thread_func(): about to enable cancellation
//sleep 100s
thread_func(): not canceled!
main(): thread wasn't canceled (shouldn't happen!)</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#information" aria-hidden="true" class="anchor" id="user-content-information" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Information</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">As man pthread_cancel say
"If a thread has disabled cancellation, then a cancellation request remains queued until the thread enables cancellation."
" Deferred cancelability means that cancellation will be delayed until the thread next calls a function that is a cancellation point. "
" Cancellation points
POSIX.1 specifies that certain functions must, and certain
other functions may, be cancellation points. If a thread is
cancelable, its cancelability type is deferred, and a cancella‐
tion request is pending for the thread, then the thread is can‐
celed when it calls a function that is a cancellation point."</p>
<p dir="auto" style="color: #28272d; margin: 0;" align="initial">//the test case for rtems
<a href="https://gitlab.rtems.org/-/project/26/uploads/3802221a7da3d2e8b85d35e8477158dc/pthread_cancel.diff" data-canonical-src="/uploads/3802221a7da3d2e8b85d35e8477158dc/pthread_cancel.diff" data-link="true" class="gfm" style="margin-top: 0;">pthread_cancel.diff</a>
//the sample code in man pthread_cancel
<a href="https://gitlab.rtems.org/-/project/26/uploads/96a574a3d50ddd4d06e4b809ef3a4237/test_cancel_posix.c" data-canonical-src="/uploads/96a574a3d50ddd4d06e4b809ef3a4237/test_cancel_posix.c" data-link="true" class="gfm">test_cancel_posix.c</a></p>
</div>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #737278;">
—
<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5181">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/sent_notifications/c448d92426f261784f42bd0f22b56574/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5181"}}</script>
</p>
</div>
</body>
</html>