<!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=UTF-8" 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: hsla(0,0%,100%,.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: hsla(0,0%,100%,.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 style="color: #777777;">
<a href="https://gitlab.rtems.org/amar">Amar Takhar</a>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5641#note_154343">commented</a>:
</p>
<div class="md" style="position: relative; z-index: 1; color: #3a383f; word-wrap: break-word;">
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">Here are my results.</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="shell" class="code highlight js-syntax-highlight language-shell" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" lang="shell" style="margin-top: 0px;">FreeBSD clang version 19.1.7 <span class="o" style="margin-top: 0px;">(</span>https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2<span class="o">)</span></span>
<span id="LC2" class="line" lang="shell">Target: x86_64-unknown-freebsd15.0</span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="shell" class="code highlight js-syntax-highlight language-shell" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" lang="shell" style="margin-top: 0px;"><span class="c" style="margin-top: 0px;"># c++ -Wall -g -o lock -lpthread lock.cpp</span></span>
<span id="LC2" class="line" lang="shell"><span class="c" style="margin-top: 0px;"># ./lock </span></span>
<span id="LC3" class="line" lang="shell">locking <span class="nb" style="margin-top: 0px;">test</span></span>
<span id="LC4" class="line" lang="shell">main: m1 at0x820d4a6b0</span>
<span id="LC5" class="line" lang="shell">main: lock: m1</span>
<span id="LC6" class="line" lang="shell">t1: unlock: m at 0x820d4a6b0</span>
<span id="LC7" class="line" lang="shell">Illegal instruction <span class="o" style="margin-top: 0px;">(</span>core dumped<span class="o">)</span> ./lock</span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<div class="gl-relative markdown-code-block js-markdown-code" style="margin-bottom: 0px;">
<pre data-canonical-lang="shell" class="code highlight js-syntax-highlight language-shell" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" lang="shell" style="margin-top: 0px;"><span class="o" style="margin-top: 0px;">(</span>gdb<span class="o">)</span> thread apply all bt</span>
<span id="LC2" class="line" lang="shell"></span>
<span id="LC3" class="line" lang="shell">Thread 2 <span class="o" style="margin-top: 0px;">(</span>LWP 810125<span class="o">)</span>:</span>
<span id="LC4" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#0 _nanosleep () at _nanosleep.S:4</span></span>
<span id="LC5" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#1 0x000000082232923c in __thr_nanosleep (time_to_sleep=0x820d4a598, time_remaining=0x820d4a598) at /usr/src/lib/libthr/thread/thr_syscalls.c:283</span></span>
<span id="LC6" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#2 0x00000008233b264b in std::__1::__libcpp_thread_sleep_for[abi:se190107](std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&) (__ns=...) at /usr/src/contrib/llvm-project/libcxx/include/__thread/support/pthread.h:198</span></span>
<span id="LC7" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#3 std::__1::this_thread::sleep_for (ns=...) at /usr/src/contrib/llvm-project/libcxx/src/thread.cpp:94</span></span>
<span id="LC8" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#4 0x0000000000204008 in std::__1::this_thread::sleep_for[abi:se190107]<long long, std::__1::ratio<1l, 1l> >(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1l> > const&) (__d=...) at /usr/include/c++/v1/__thread/this_thread.h:48</span></span>
<span id="LC9" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#5 0x0000000000203b9c in main () at lock.cpp:25</span></span>
<span id="LC10" class="line" lang="shell"></span>
<span id="LC11" class="line" lang="shell">Thread 1 <span class="o" style="margin-top: 0px;">(</span>LWP 965367<span class="o">)</span>:</span>
<span id="LC12" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#0 0x00000008233a440f in __clang_trap_msg$libc++$/usr/src/contrib/llvm-project/libcxx/src/mutex.cpp:40: assertion ec == 0 failed: call to mutex::unlock failed. A possible reason is that the mutex wasn't locked</span></span>
<span id="LC13" class="line" lang="shell"> <span class="o" style="margin-top: 0px;">()</span> at /usr/src/contrib/llvm-project/libcxx/src/mutex.cpp:41</span>
<span id="LC14" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#1 std::__1::mutex::unlock (this=<optimized out>) at /usr/src/contrib/llvm-project/libcxx/src/mutex.cpp:39</span></span>
<span id="LC15" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#2 0x0000000000203a7e in t1_body (m=...) at lock.cpp:9</span></span>
<span id="LC16" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#3 0x000000000020509d in std::__1::__invoke[abi:se190107]<void (*)(std::__1::mutex&), std::__1::reference_wrapper<std::__1::mutex> >(void (*&&)(std::__1::mutex&), std::__1::reference_wrapper<std::__1::mutex>&&) (__f=@0xf1cd140b028: 0x203a20 <t1_body(std::__1::mutex&)>, __args=...) at /usr/include/c++/v1/__type_traits/invoke.h:150</span></span>
<span id="LC17" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#4 0x000000000020501e in std::__1::__thread_execute[abi:se190107]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::mutex&), std::__1::reference_wrapper<std::__1::mutex>, 2ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::mutex&), std::__1::reference_wrapper<std::__1::mutex> >&, std::__1::__tuple_indices<2ul>) (__t=...) at /usr/include/c++/v1/__thread/thread.h:192</span></span>
<span id="LC18" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#5 0x0000000000204b9c in std::__1::__thread_proxy[abi:se190107]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::mutex&), std::__1::reference_wrapper<std::__1::mutex> > >(void*) (__vp=0xf1cd140b020) at /usr/include/c++/v1/__thread/thread.h:201</span></span>
<span id="LC19" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#6 0x000000082231dd21 in thread_start (curthread=0xf1cd1044810) at /usr/src/lib/libthr/thread/thr_create.c:299</span></span>
<span id="LC20" class="line" lang="shell"><span class="c" style="margin-top: 0px;">#7 0x0000000000000000 in ?? ()</span></span>
<span id="LC21" class="line" lang="shell">Backtrace stopped: Cannot access memory at address 0x828a94000</span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
</div>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #626168;">
—
<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5641#note_154343">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/4-a6zujcs7i3i4lcn49nvo9ri6d-1d/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>
<span style="color: transparent; font-size: 0; display: none; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0;">
Notification message regarding https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5641#note_154343 at 1783910171
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Work item","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5641#note_154343"}}</script>
</p>
</div>
</body>
</html>