diff options
| author | muqiuhan <[email protected]> | 2024-08-02 03:27:42 +0000 |
|---|---|---|
| committer | muqiuhan <[email protected]> | 2024-08-02 03:27:42 +0000 |
| commit | 41537d9d09b52834c603101c4111955f6f55ece7 (patch) | |
| tree | 357ecd0a9f5789e4a538789632a644387402cac4 | |
| parent | 13c421ac7f9b895930b0ed8207ca114b1d91dbc2 (diff) | |
| download | blog-41537d9d09b52834c603101c4111955f6f55ece7.tar.gz | |
deploy: 38bdfa3137383f8dc650517d3cbfb26997cd771a
| -rw-r--r-- | 2024/07/23/OCaml-News-2024-6/index.html | 5 | ||||
| -rw-r--r-- | 2024/08/02/二〇二四年八月一日/index.html | 257 | ||||
| -rw-r--r-- | archives/2024/08/index.html | 217 | ||||
| -rw-r--r-- | archives/2024/index.html | 36 | ||||
| -rw-r--r-- | archives/2024/page/2/index.html | 36 | ||||
| -rw-r--r-- | archives/2024/page/3/index.html | 18 | ||||
| -rw-r--r-- | archives/index.html | 36 | ||||
| -rw-r--r-- | archives/page/10/index.html | 18 | ||||
| -rw-r--r-- | archives/page/2/index.html | 36 | ||||
| -rw-r--r-- | archives/page/3/index.html | 36 | ||||
| -rw-r--r-- | archives/page/4/index.html | 36 | ||||
| -rw-r--r-- | archives/page/5/index.html | 36 | ||||
| -rw-r--r-- | archives/page/6/index.html | 36 | ||||
| -rw-r--r-- | archives/page/7/index.html | 36 | ||||
| -rw-r--r-- | archives/page/8/index.html | 36 | ||||
| -rw-r--r-- | archives/page/9/index.html | 36 | ||||
| -rw-r--r-- | categories/gallery/index.html | 48 | ||||
| -rw-r--r-- | categories/gallery/page/2/index.html | 48 | ||||
| -rw-r--r-- | categories/gallery/page/3/index.html | 48 | ||||
| -rw-r--r-- | categories/gallery/page/4/index.html | 48 | ||||
| -rw-r--r-- | categories/gallery/page/5/index.html | 24 | ||||
| -rw-r--r-- | img/二〇二四年八月一日.jpg | bin | 0 -> 289700 bytes | |||
| -rw-r--r-- | search.xml | 64 |
23 files changed, 872 insertions, 319 deletions
diff --git a/2024/07/23/OCaml-News-2024-6/index.html b/2024/07/23/OCaml-News-2024-6/index.html index 5a9d12e4..ba59bb45 100644 --- a/2024/07/23/OCaml-News-2024-6/index.html +++ b/2024/07/23/OCaml-News-2024-6/index.html @@ -271,6 +271,11 @@ <nav class="post-nav"> <div class="prev-item"> + <div class="icon arrow-left"></div> + <div class="post-link"> + <a href="/2024/08/02/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5/">Prev</a> + </div> + </div> <div class="next-item"> diff --git a/2024/08/02/二〇二四年八月一日/index.html b/2024/08/02/二〇二四年八月一日/index.html new file mode 100644 index 00000000..690e8083 --- /dev/null +++ b/2024/08/02/二〇二四年八月一日/index.html @@ -0,0 +1,257 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"> +<meta name="viewport" + content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> +<meta http-equiv="X-UA-Compatible" content="ie=edge"> + + <meta name="author" content="韩暮秋"> + + + <meta name="subtitle" content="暮秋小屋"> + + + <meta name="description" content="这里是暮秋小屋,思念和灵感的寄存处"> + + + <meta name="keywords" content="韩暮秋,MuqiuHan,'Muqiu Han', 'muqiu han', muqiuhan"> + + + + +<title>二〇二四年八月一日 | 暮秋小屋</title> + + + + <link rel="icon" href="/favicon.ico"> + + + +<style> + @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&family=Roboto+Mono&display=swap'); +</style> + + + + <!-- stylesheets list from _config.yml --> + + <link rel="stylesheet" href="/css/style.css"> + + + + + + <!-- scripts list from _config.yml --> + + <script src="/js/frame.js"></script> + + + + + + <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> + <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> + + + + + + + + <meta name="generator" content="Hexo 6.3.0"></head> + <body> + <div class="mask-border"> + </div> + + <div class="wrapper"> + + <div class="header"> + <div class="flex-container"> + <div class="header-inner"> + <div class="site-brand-container"> + <a href="/"> + + 暮秋小屋 + + </a> + </div> + <div id="menu-btn" class="menu-btn" onclick="toggleMenu()"> + Menu + </div> + <nav class="site-nav"> + <ul class="menu-list"> + + + <li class="menu-item"> + <a href="/">主页</a> + </li> + + + + <li class="menu-item"> + <a href="/categories/gallery/">日记本</a> + </li> + + + + <li class="menu-item"> + <a href="/tags/Medicine/">医学</a> + </li> + + + + <li class="menu-item"> + <a href="/tags/Technique/">计算机科学</a> + </li> + + + + <li class="menu-item"> + <a href="/tags/Life/">生活</a> + </li> + + + + <li class="menu-item"> + <a href="/about">关于</a> + </li> + + + + <li class="menu-item search-btn"> + <a href="#">Search</a> + </li> + + </ul> + </nav> + </div> + </div> +</div> + + + <div class="main"> + <div class="flex-container"> + <article id="post"> + + + <div class="post-head"> + <div class="post-info"> + <div class="tag-list"> + + </div> + <div class="post-title"> + + + 二〇二四年八月一日 + + + </div> + <span class="post-date"> + Aug 2, 2024 + </span> + </div> + <div class="post-img"> + + <img src="/img/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5.jpg" alt="featured_image"> + + </div> +</div> + <div class="post-content"> + <p>我们之所以看到宇宙是这个样子,是因为如果它不是这样的话,我们就不会在这里去观察它。</p> +<p>如果我们仔细思考关于可能存在的宇宙的巨大迷宫,<br>我们就会发现大部分宇宙没有适合生命生产的条件,<br>哪怕任何与已知生命相近的东西,<br>以世人所熟悉的物理剧变来说,<br>这一点再清晰不过了,<br>If our universe didn’t conform to the rules it does,<br>Life as we know it would not exist,<br>哪怕是不那么激烈的物理变化也会干扰星球的形成,<br>比如,<br>扰乱他们作为宇宙熔炉的能力,<br>即合成维系生命的复杂的原子,<br>如碳原子,氧原子,<br>而碳氧原子通常是因超新星爆炸喷涌而出,<br>并散布在整个宇宙中的,<br>鉴于生命高度依赖于物理的各个细支,<br>如果我们现在发问,比如,<br>为什么自然中的各种力和粒子有我们观察到的各种特定属性组合,<br>一个合理的答案,<br>越过所有的可能性闪现出来,<br>这些特点各有不同,<br>属性也各有不同,<br>What’s special about the particular combination of particle and force properties we observe,<br>Is that clearly they allow life to form,<br>而生命,尤其是有智慧的生命,<br>是得以思考宇宙有如此属性,<br>的先决条件,<br>简单来说,<br>事物生来便是如此,<br>Because if they weren’t,<br>We wouldnt be here to notice,</p> +<p>If we weren’t here,<br>There’d be no one to see。</p> +<p>政治和工业的缺失,<br>诸神危机,<br>短浅目光,<br>停止怀疑其真伪,<br>你的敬畏感,<br>你的惊奇感,<br>面对这一切时丝毫无损,<br>也许适时的,<br>会有人听到这段残声,<br>这段无主题的演讲。</p> +<hr> +<p>阿公烧烟成老瘾,<br>阿公饮酒会面红,<br>他说日子要开心,<br>他说人生要尽兴。</p> + +</div> + +<script> + window.onload = detectors(); +</script> + <div class="post-footer"> + <div class="h-line-primary"></div> + <nav class="post-nav"> + <div class="prev-item"> + + </div> + <div class="next-item"> + + <div class="icon arrow-right"></div> + <div class="post-link"> + <a href="/2024/07/23/OCaml-News-2024-6/">Next</a> + </div> + + </div> + </nav> +</div> + + + <div class="post-comment"> + + + + + + + +</div> + + +</article> + </div> + </div> + + <div class="footer"> + <div class="flex-container"> + <div class="footer-text"> + + + | + + + 希望路过的人可以添点柴火让这里暖和点 + + </div> + </div> +</div> + + </div> + + + <div class="search-popup"> + <div class="search-popup-overlay"> + </div> + <div class="search-popup-window" > + <div class="search-header"> + <div class="search-input-container"> + <input autocomplete="off" autocapitalize="off" maxlength="80" + placeholder="Search Anything" spellcheck="false" + type="search" class="search-input"> + </div> + <div class="search-close-btn"> + <div class="icon close-btn"></div> + </div> + </div> + <div class="search-result-container"> + </div> + </div> +</div> + +<script> + const searchConfig = { + path : "/search.xml", + top_n_per_article: "1", + unescape : "false", + trigger: "auto", + preload: "false" + } +</script> +<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/search.js"></script> +<script src="/js/search.js"></script> + + + + </body> +</html> diff --git a/archives/2024/08/index.html b/archives/2024/08/index.html new file mode 100644 index 00000000..34ec9943 --- /dev/null +++ b/archives/2024/08/index.html @@ -0,0 +1,217 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"> +<meta name="viewport" + content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> +<meta http-equiv="X-UA-Compatible" content="ie=edge"> + + <meta name="author" content="韩暮秋"> + + + <meta name="subtitle" content="暮秋小屋"> + + + <meta name="description" content="这里是暮秋小屋,思念和灵感的寄存处"> + + + <meta name="keywords" content="韩暮秋,MuqiuHan,'Muqiu Han', 'muqiu han', muqiuhan"> + + + + +<title>Archive: 2024/8 | 暮秋小屋</title> + + + + <link rel="icon" href="/favicon.ico"> + + + +<style> + @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&family=Roboto+Mono&display=swap'); +</style> + + + + <!-- stylesheets list from _config.yml --> + + <link rel="stylesheet" href="/css/style.css"> + + + + + + <!-- scripts list from _config.yml --> + + <script src="/js/frame.js"></script> + + + + + + <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> + <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> + + + + + + + + <meta name="generator" content="Hexo 6.3.0"></head> + <body> + <div class="mask-border"> + </div> + + <div class="wrapper"> + + <div class="header"> + <div class="flex-container"> + <div class="header-inner"> + <div class="site-brand-container"> + <a href="/"> + + 暮秋小屋 + + </a> + </div> + <div id="menu-btn" class="menu-btn" onclick="toggleMenu()"> + Menu + </div> + <nav class="site-nav"> + <ul class="menu-list"> + + + <li class="menu-item"> + <a href="/">主页</a> + </li> + + + + <li class="menu-item"> + <a href="/categories/gallery/">日记本</a> + </li> + + + + <li class="menu-item"> + <a href="/tags/Medicine/">医学</a> + </li> + + + + <li class="menu-item"> + <a href="/tags/Technique/">计算机科学</a> + </li> + + + + <li class="menu-item"> + <a href="/tags/Life/">生活</a> + </li> + + + + <li class="menu-item"> + <a href="/about">关于</a> + </li> + + + + <li class="menu-item search-btn"> + <a href="#">Search</a> + </li> + + </ul> + </nav> + </div> + </div> +</div> + + + <div class="main"> + <div class="flex-container"> + <div class="post-list"> + + + + + + + <div class="year-title">2024</div> + + + <div class="post-list-item"> + <div class="post-title"> + <a href="/2024/08/02/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5/"> + + 二〇二四年八月一日 + + </a> + </div> + + <span class="post-date">Aug 2, 2024</span> + </div> + + + <div id="paginator"> + + </div> +</div> + + </div> + </div> + + <div class="footer"> + <div class="flex-container"> + <div class="footer-text"> + + + | + + + 希望路过的人可以添点柴火让这里暖和点 + + </div> + </div> +</div> + + </div> + + + <div class="search-popup"> + <div class="search-popup-overlay"> + </div> + <div class="search-popup-window" > + <div class="search-header"> + <div class="search-input-container"> + <input autocomplete="off" autocapitalize="off" maxlength="80" + placeholder="Search Anything" spellcheck="false" + type="search" class="search-input"> + </div> + <div class="search-close-btn"> + <div class="icon close-btn"></div> + </div> + </div> + <div class="search-result-container"> + </div> + </div> +</div> + +<script> + const searchConfig = { + path : "/search.xml", + top_n_per_article: "1", + unescape : "false", + trigger: "auto", + preload: "false" + } +</script> +<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/search.js"></script> +<script src="/js/search.js"></script> + + + + </body> +</html> diff --git a/archives/2024/index.html b/archives/2024/index.html index 6776fb22..87ecf288 100644 --- a/archives/2024/index.html +++ b/archives/2024/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2024/08/02/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5/"> + + 二〇二四年八月一日 + + </a> + </div> + + <span class="post-date">Aug 2, 2024</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2024/07/23/OCaml-News-2024-6/"> OCaml News 2024-6 @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2024/05/07/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%BA%94%E6%9C%88%E4%B8%83%E6%97%A5/"> - - 二〇二四年五月七日 - - </a> - </div> - - <span class="post-date">May 7, 2024</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/2024/page/2/index.html b/archives/2024/page/2/index.html index e1289613..13194f68 100644 --- a/archives/2024/page/2/index.html +++ b/archives/2024/page/2/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2024/05/07/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%BA%94%E6%9C%88%E4%B8%83%E6%97%A5/"> + + 二〇二四年五月七日 + + </a> + </div> + + <span class="post-date">May 7, 2024</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2024/04/08/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%9B%9B%E6%9C%88%E5%85%AB%E6%97%A5/"> 二〇二四年四月八日 @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2024/01/23/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B8%89%E6%97%A5/"> - - 二〇二四年一月二十三日 - - </a> - </div> - - <span class="post-date">Jan 23, 2024</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/2024/page/3/index.html b/archives/2024/page/3/index.html index 9e8a8a4c..88130134 100644 --- a/archives/2024/page/3/index.html +++ b/archives/2024/page/3/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2024/01/23/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B8%89%E6%97%A5/"> + + 二〇二四年一月二十三日 + + </a> + </div> + + <span class="post-date">Jan 23, 2024</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2024/01/22/Rescript-React-Native/"> Rescript and React Native diff --git a/archives/index.html b/archives/index.html index 55b0bbc9..490c3ccd 100644 --- a/archives/index.html +++ b/archives/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2024/08/02/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5/"> + + 二〇二四年八月一日 + + </a> + </div> + + <span class="post-date">Aug 2, 2024</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2024/07/23/OCaml-News-2024-6/"> OCaml News 2024-6 @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2024/05/07/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%BA%94%E6%9C%88%E4%B8%83%E6%97%A5/"> - - 二〇二四年五月七日 - - </a> - </div> - - <span class="post-date">May 7, 2024</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/10/index.html b/archives/page/10/index.html index f7bebd82..59f865d2 100644 --- a/archives/page/10/index.html +++ b/archives/page/10/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2020/12/09/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E4%B9%9D%E6%97%A5/"> + + 二零二零年十二月九日 + + </a> + </div> + + <span class="post-date">Dec 9, 2020</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2020/12/08/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E5%85%AB%E6%97%A5/"> 二零二零年十二月八日 diff --git a/archives/page/2/index.html b/archives/page/2/index.html index d65ce654..749c6a02 100644 --- a/archives/page/2/index.html +++ b/archives/page/2/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2024/05/07/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%BA%94%E6%9C%88%E4%B8%83%E6%97%A5/"> + + 二〇二四年五月七日 + + </a> + </div> + + <span class="post-date">May 7, 2024</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2024/04/08/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%9B%9B%E6%9C%88%E5%85%AB%E6%97%A5/"> 二〇二四年四月八日 @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2024/01/23/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B8%89%E6%97%A5/"> - - 二〇二四年一月二十三日 - - </a> - </div> - - <span class="post-date">Jan 23, 2024</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/3/index.html b/archives/page/3/index.html index 48063291..a403a614 100644 --- a/archives/page/3/index.html +++ b/archives/page/3/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2024/01/23/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B8%89%E6%97%A5/"> + + 二〇二四年一月二十三日 + + </a> + </div> + + <span class="post-date">Jan 23, 2024</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2024/01/22/Rescript-React-Native/"> Rescript and React Native @@ -301,24 +319,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2023/10/25/%E5%84%BF%E7%AB%A5%E6%96%B0%E5%9E%8B%E5%86%A0%E7%8A%B6%E7%97%85%E6%AF%92Omicron%E6%A0%AA%E5%92%8C%E8%82%BA%E7%82%8E%E6%94%AF%E5%8E%9F%E4%BD%93%E6%B7%B7%E5%90%88%E6%84%9F%E6%9F%93%E9%87%8D%E7%97%87%E8%82%BA%E7%82%8E1%E4%BE%8B/"> - - 儿童新型冠状病毒Omicron株和肺炎支原体混合感染重症肺炎1例 - - </a> - </div> - - <span class="post-date">Oct 25, 2023</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/4/index.html b/archives/page/4/index.html index 434c955c..20bd031f 100644 --- a/archives/page/4/index.html +++ b/archives/page/4/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2023/10/25/%E5%84%BF%E7%AB%A5%E6%96%B0%E5%9E%8B%E5%86%A0%E7%8A%B6%E7%97%85%E6%AF%92Omicron%E6%A0%AA%E5%92%8C%E8%82%BA%E7%82%8E%E6%94%AF%E5%8E%9F%E4%BD%93%E6%B7%B7%E5%90%88%E6%84%9F%E6%9F%93%E9%87%8D%E7%97%87%E8%82%BA%E7%82%8E1%E4%BE%8B/"> + + 儿童新型冠状病毒Omicron株和肺炎支原体混合感染重症肺炎1例 + + </a> + </div> + + <span class="post-date">Oct 25, 2023</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2023/10/25/Radiographic-Absence-of-the-Left-Humeral-Head/"> Radiographic Absence of the Left Humeral Head @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2023/09/13/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E4%B9%9D%E6%9C%88%E5%8D%81%E4%B8%89%E6%97%A5/"> - - 二零二三年九月十三日 - - </a> - </div> - - <span class="post-date">Sep 13, 2023</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/5/index.html b/archives/page/5/index.html index 1bf37cd9..3c1769bc 100644 --- a/archives/page/5/index.html +++ b/archives/page/5/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2023/09/13/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E4%B9%9D%E6%9C%88%E5%8D%81%E4%B8%89%E6%97%A5/"> + + 二零二三年九月十三日 + + </a> + </div> + + <span class="post-date">Sep 13, 2023</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2023/08/27/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%85%AB%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B8%83%E6%97%A5/"> 二零二三年八月二十七日 @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2023/06/28/caml-release-runtime-system%E5%AF%BC%E8%87%B4%E7%9A%84%E6%AD%BB%E9%94%81%E9%97%AE%E9%A2%98/"> - - caml_release_runtime_system导致的死锁问题 - - </a> - </div> - - <span class="post-date">Jun 28, 2023</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/6/index.html b/archives/page/6/index.html index 25511498..290c085e 100644 --- a/archives/page/6/index.html +++ b/archives/page/6/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2023/06/28/caml-release-runtime-system%E5%AF%BC%E8%87%B4%E7%9A%84%E6%AD%BB%E9%94%81%E9%97%AE%E9%A2%98/"> + + caml_release_runtime_system导致的死锁问题 + + </a> + </div> + + <span class="post-date">Jun 28, 2023</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2023/06/22/%E7%81%AF%E7%AC%BC%E8%8D%89/"> 灯笼草 @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2023/05/01/Rust-%E8%99%9A%E8%A1%A8%E5%B8%83%E5%B1%80%E8%A7%84%E5%88%99%E4%BB%8B%E7%BB%8D/"> - - Rust 虚表布局规则介绍 - - </a> - </div> - - <span class="post-date">May 1, 2023</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/7/index.html b/archives/page/7/index.html index 9c5b8abd..48e4694b 100644 --- a/archives/page/7/index.html +++ b/archives/page/7/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2023/05/01/Rust-%E8%99%9A%E8%A1%A8%E5%B8%83%E5%B1%80%E8%A7%84%E5%88%99%E4%BB%8B%E7%BB%8D/"> + + Rust 虚表布局规则介绍 + + </a> + </div> + + <span class="post-date">May 1, 2023</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2023/04/30/TypeScript-With-Rust-Errors-No-Try-Catch-Heresy/"> TypeScript With Rust Errors, No Try Catch, Heresy @@ -299,24 +317,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2023/03/01/%E7%BA%AF%E7%89%9B%E5%A5%B6%E5%8F%AF%E4%BB%A5%E5%8A%A0%E7%82%B9%E5%95%A5/"> - - 纯牛奶可以加点啥 - - </a> - </div> - - <span class="post-date">Mar 1, 2023</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/8/index.html b/archives/page/8/index.html index 034a71d9..bacdd34c 100644 --- a/archives/page/8/index.html +++ b/archives/page/8/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2023/03/01/%E7%BA%AF%E7%89%9B%E5%A5%B6%E5%8F%AF%E4%BB%A5%E5%8A%A0%E7%82%B9%E5%95%A5/"> + + 纯牛奶可以加点啥 + + </a> + </div> + + <span class="post-date">Mar 1, 2023</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2023/02/26/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E4%BA%8C%E6%9C%88%E4%BA%8C%E5%8D%81%E5%85%AD%E6%97%A5/"> 二零二三年二月二十六日 @@ -301,24 +319,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2022/10/01/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E5%8D%81%E6%9C%88%E4%B8%80%E6%97%A5/"> - - 二零二二年十月一日 - - </a> - </div> - - <span class="post-date">Oct 1, 2022</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/archives/page/9/index.html b/archives/page/9/index.html index 239f891b..368c7deb 100644 --- a/archives/page/9/index.html +++ b/archives/page/9/index.html @@ -144,6 +144,24 @@ <div class="post-list-item"> <div class="post-title"> + <a href="/2022/10/01/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E5%8D%81%E6%9C%88%E4%B8%80%E6%97%A5/"> + + 二零二二年十月一日 + + </a> + </div> + + <span class="post-date">Oct 1, 2022</span> + </div> + + + + + + + + <div class="post-list-item"> + <div class="post-title"> <a href="/2022/09/22/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E4%B9%9D%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/"> 二零二二年九月二十二日 @@ -303,24 +321,6 @@ </div> - - - - - - <div class="post-list-item"> - <div class="post-title"> - <a href="/2020/12/09/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E4%B9%9D%E6%97%A5/"> - - 二零二零年十二月九日 - - </a> - </div> - - <span class="post-date">Dec 9, 2020</span> - </div> - - <div id="paginator"> <div class=paginator> diff --git a/categories/gallery/index.html b/categories/gallery/index.html index f209adce..be7e7f70 100644 --- a/categories/gallery/index.html +++ b/categories/gallery/index.html @@ -142,6 +142,30 @@ </div> <div class="post-title"> + <a href="/2024/08/02/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5/"</a> + + 二〇二四年八月一日 + + </a> + </div> + <span class="post-date"> + Aug 2, 2024 + </span> + </div> + <div class="post-img"> + + <img src="/img/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5.jpg" alt="featured_image"> + + </div> + </div> + <div class="h-line-secondary"></div> + + <div class="post-gallery-item"> + <div class="post-info"> + <div class="tag-list"> + + </div> + <div class="post-title"> <a href="/2024/06/27/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AD%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B8%83%E6%97%A5/"</a> 二〇二四年六月二十七日 @@ -352,30 +376,6 @@ </div> <div class="h-line-secondary"></div> - <div class="post-gallery-item"> - <div class="post-info"> - <div class="tag-list"> - - </div> - <div class="post-title"> - <a href="/2023/11/29/%E4%BA%8C%E3%80%87%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%8D%81%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B9%9D%E6%97%A5/"</a> - - 二〇二三年十一月二十九日 - - </a> - </div> - <span class="post-date"> - Nov 29, 2023 - </span> - </div> - <div class="post-img"> - - <img src="/img/%E4%BA%8C%E3%80%87%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%8D%81%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B9%9D%E6%97%A5.jpg" alt="featured_image"> - - </div> - </div> - <div class="h-line-secondary"></div> - </div> <div id="paginator"> diff --git a/categories/gallery/page/2/index.html b/categories/gallery/page/2/index.html index cf4092ce..4ae36049 100644 --- a/categories/gallery/page/2/index.html +++ b/categories/gallery/page/2/index.html @@ -142,6 +142,30 @@ </div> <div class="post-title"> + <a href="/2023/11/29/%E4%BA%8C%E3%80%87%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%8D%81%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B9%9D%E6%97%A5/"</a> + + 二〇二三年十一月二十九日 + + </a> + </div> + <span class="post-date"> + Nov 29, 2023 + </span> + </div> + <div class="post-img"> + + <img src="/img/%E4%BA%8C%E3%80%87%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%8D%81%E4%B8%80%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B9%9D%E6%97%A5.jpg" alt="featured_image"> + + </div> + </div> + <div class="h-line-secondary"></div> + + <div class="post-gallery-item"> + <div class="post-info"> + <div class="tag-list"> + + </div> + <div class="post-title"> <a href="/2023/11/06/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%8D%81%E4%B8%80%E6%9C%88%E5%85%AD%E6%97%A5/"</a> 二零二三年十一月六日 @@ -352,30 +376,6 @@ </div> <div class="h-line-secondary"></div> - <div class="post-gallery-item"> - <div class="post-info"> - <div class="tag-list"> - - </div> - <div class="post-title"> - <a href="/2023/04/22/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%9B%9B%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/"</a> - - 二零二三年四月二十二日 - - </a> - </div> - <span class="post-date"> - Apr 22, 2023 - </span> - </div> - <div class="post-img"> - - <img src="/img/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%9B%9B%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5.jpg" alt="featured_image"> - - </div> - </div> - <div class="h-line-secondary"></div> - </div> <div id="paginator"> diff --git a/categories/gallery/page/3/index.html b/categories/gallery/page/3/index.html index 1f26259c..1a2e79ca 100644 --- a/categories/gallery/page/3/index.html +++ b/categories/gallery/page/3/index.html @@ -142,6 +142,30 @@ </div> <div class="post-title"> + <a href="/2023/04/22/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%9B%9B%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/"</a> + + 二零二三年四月二十二日 + + </a> + </div> + <span class="post-date"> + Apr 22, 2023 + </span> + </div> + <div class="post-img"> + + <img src="/img/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E5%9B%9B%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5.jpg" alt="featured_image"> + + </div> + </div> + <div class="h-line-secondary"></div> + + <div class="post-gallery-item"> + <div class="post-info"> + <div class="tag-list"> + + </div> + <div class="post-title"> <a href="/2023/02/26/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E4%BA%8C%E6%9C%88%E4%BA%8C%E5%8D%81%E5%85%AD%E6%97%A5/"</a> 二零二三年二月二十六日 @@ -352,30 +376,6 @@ </div> <div class="h-line-secondary"></div> - <div class="post-gallery-item"> - <div class="post-info"> - <div class="tag-list"> - - </div> - <div class="post-title"> - <a href="/2022/10/01/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E5%8D%81%E6%9C%88%E4%B8%80%E6%97%A5/"</a> - - 二零二二年十月一日 - - </a> - </div> - <span class="post-date"> - Oct 1, 2022 - </span> - </div> - <div class="post-img"> - - <img src="/img/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E5%8D%81%E6%9C%88%E4%B8%80%E6%97%A5.jpg" alt="featured_image"> - - </div> - </div> - <div class="h-line-secondary"></div> - </div> <div id="paginator"> diff --git a/categories/gallery/page/4/index.html b/categories/gallery/page/4/index.html index 58832072..a4c105d0 100644 --- a/categories/gallery/page/4/index.html +++ b/categories/gallery/page/4/index.html @@ -142,6 +142,30 @@ </div> <div class="post-title"> + <a href="/2022/10/01/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E5%8D%81%E6%9C%88%E4%B8%80%E6%97%A5/"</a> + + 二零二二年十月一日 + + </a> + </div> + <span class="post-date"> + Oct 1, 2022 + </span> + </div> + <div class="post-img"> + + <img src="/img/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E5%8D%81%E6%9C%88%E4%B8%80%E6%97%A5.jpg" alt="featured_image"> + + </div> + </div> + <div class="h-line-secondary"></div> + + <div class="post-gallery-item"> + <div class="post-info"> + <div class="tag-list"> + + </div> + <div class="post-title"> <a href="/2022/09/22/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E4%B9%9D%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/"</a> 二零二二年九月二十二日 @@ -352,30 +376,6 @@ </div> <div class="h-line-secondary"></div> - <div class="post-gallery-item"> - <div class="post-info"> - <div class="tag-list"> - - </div> - <div class="post-title"> - <a href="/2020/12/09/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E4%B9%9D%E6%97%A5/"</a> - - 二零二零年十二月九日 - - </a> - </div> - <span class="post-date"> - Dec 9, 2020 - </span> - </div> - <div class="post-img"> - - <img src="/img/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E4%B9%9D%E6%97%A5.webp" alt="featured_image"> - - </div> - </div> - <div class="h-line-secondary"></div> - </div> <div id="paginator"> diff --git a/categories/gallery/page/5/index.html b/categories/gallery/page/5/index.html index 433a9122..c60f1ce0 100644 --- a/categories/gallery/page/5/index.html +++ b/categories/gallery/page/5/index.html @@ -142,6 +142,30 @@ </div> <div class="post-title"> + <a href="/2020/12/09/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E4%B9%9D%E6%97%A5/"</a> + + 二零二零年十二月九日 + + </a> + </div> + <span class="post-date"> + Dec 9, 2020 + </span> + </div> + <div class="post-img"> + + <img src="/img/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E4%B9%9D%E6%97%A5.webp" alt="featured_image"> + + </div> + </div> + <div class="h-line-secondary"></div> + + <div class="post-gallery-item"> + <div class="post-info"> + <div class="tag-list"> + + </div> + <div class="post-title"> <a href="/2020/12/08/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E9%9B%B6%E5%B9%B4%E5%8D%81%E4%BA%8C%E6%9C%88%E5%85%AB%E6%97%A5/"</a> 二零二零年十二月八日 diff --git a/img/二〇二四年八月一日.jpg b/img/二〇二四年八月一日.jpg Binary files differnew file mode 100644 index 00000000..491061cc --- /dev/null +++ b/img/二〇二四年八月一日.jpg @@ -953,6 +953,31 @@ </tags> </entry> <entry> + <title>caml_release_runtime_system导致的死锁问题</title> + <url>/2023/06/28/caml-release-runtime-system%E5%AF%BC%E8%87%B4%E7%9A%84%E6%AD%BB%E9%94%81%E9%97%AE%E9%A2%98/</url> + <content><![CDATA[<p>给出一个<code>test.ml</code>:</p> +<figure class="highlight ocaml"><table><tr><td class="code"><pre><span class="line"><span class="type">Printf</span>.eprintf <span class="string">"hello from OCaml\n%!"</span></span><br></pre></td></tr></table></figure> + +<p>和<code>test-ocaml-5.c</code>:</p> +<figure class="highlight c"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><stdio.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><stdlib.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><caml/misc.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><caml/callback.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><caml/threads.h></span></span></span><br><span class="line"></span><br><span class="line"><span class="type">int</span></span><br><span class="line"><span class="title function_">main</span> <span class="params">(<span class="type">int</span> argc, <span class="type">char</span> *argv[])</span></span><br><span class="line"> {</span><br><span class="line"> <span class="built_in">fprintf</span> (<span class="built_in">stderr</span>, <span class="string">"starting up ...\n"</span>);</span><br><span class="line"> caml_startup (argv);</span><br><span class="line"> <span class="built_in">fprintf</span> (<span class="built_in">stderr</span>, <span class="string">"acquiring ...\n"</span>);</span><br><span class="line"> caml_acquire_runtime_system ();</span><br><span class="line"> <span class="built_in">fprintf</span> (<span class="built_in">stderr</span>, <span class="string">"acquired\n"</span>);</span><br><span class="line"> <span class="comment">// here is where I would be calling an OCaml callback</span></span><br><span class="line"> <span class="comment">// omitted for simplicity</span></span><br><span class="line"> caml_release_runtime_system ();</span><br><span class="line"> <span class="built_in">exit</span> (<span class="number">0</span>);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure> + +<p>然后用OCaml5的ocaml native compiler编译一下(这里我用的是<code>ocaml-variants.5.0.0+options</code>):<br><code>ocamlopt -g test-ocaml-5.c test.ml -o test-ocaml-5</code></p> +<p>运行<code>test-ocaml-5</code> 会出现:</p> +<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">starting up ...</span><br><span class="line">hello from OCaml</span><br><span class="line">acquiring ...</span><br><span class="line">Fatal error: Fatal error during lock: Resource deadlock avoided</span><br><span class="line"></span><br><span class="line">[1] 8998 IOT instruction (core dumped) ./test-ocaml-5</span><br></pre></td></tr></table></figure> + +<p>这里我尝试了一下 4.14.0 和 4.14.1 , 都没有出现这个情况,而如果用<code>threads</code>编译的话:<br><code>ocamlopt -g -I +unix unix.cmxa -I +threads threads.cmxa test-ocaml-5.c test.ml -o test-ocaml-5</code></p> +<p>无论在5.0还是4.14.x,都会挂起。</p> +<p>出现这个问题的一个可能原因是,在<code>test-ocaml-5.c</code>中,我在开头调用了<code>caml_startup()</code>,这会让当前线程获取锁,而<code>caml_acquire_runtime_system()</code>会再次获取它,<code>caml_acquire_runtime_system()</code> 应该在<code>caml_release_runtime_system()</code>之后调用:</p> +<figure class="highlight ocaml"><table><tr><td class="code"><pre><span class="line"><span class="built_in">int</span></span><br><span class="line">main (<span class="built_in">int</span> argc, <span class="built_in">char</span> *argv<span class="literal">[]</span>)</span><br><span class="line"> {</span><br><span class="line"> fprintf (stderr, <span class="string">"starting up ...\n"</span>);</span><br><span class="line"> caml_startup (argv);</span><br><span class="line"> fprintf (stderr, <span class="string">"acquiring ...\n"</span>);</span><br><span class="line"> caml_release_runtime_system <span class="literal">()</span>;</span><br><span class="line"> caml_acquire_runtime_system <span class="literal">()</span>;</span><br><span class="line"> fprintf (stderr, <span class="string">"acquired\n"</span>);</span><br><span class="line"> exit (<span class="number">0</span>);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure> + +<p>运行结果为:</p> +<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">starting up ...</span><br><span class="line">hello from OCaml</span><br><span class="line">acquiring ...</span><br><span class="line">acquired</span><br></pre></td></tr></table></figure>]]></content> + <tags> + <tag>Technique</tag> + <tag>OCaml</tag> + </tags> + </entry> + <entry> <title>WiscKey: Separating Keys from Values in SSD-conscious Storage</title> <url>/2023/07/21/WiscKey-Separating-Keys-from-Values-in-SSD-conscious-Storage/</url> <content><![CDATA[<p>We present WiscKey, a persistent LSM-tree-based key-value store with a performance-oriented data layoutthat separates keys from values to minimize I/O amplifi-cation. The design of WiscKey is highly SSD optimized, leveraging both the sequential and random performance characteristics of the device.</p> @@ -992,31 +1017,6 @@ </tags> </entry> <entry> - <title>caml_release_runtime_system导致的死锁问题</title> - <url>/2023/06/28/caml-release-runtime-system%E5%AF%BC%E8%87%B4%E7%9A%84%E6%AD%BB%E9%94%81%E9%97%AE%E9%A2%98/</url> - <content><![CDATA[<p>给出一个<code>test.ml</code>:</p> -<figure class="highlight ocaml"><table><tr><td class="code"><pre><span class="line"><span class="type">Printf</span>.eprintf <span class="string">"hello from OCaml\n%!"</span></span><br></pre></td></tr></table></figure> - -<p>和<code>test-ocaml-5.c</code>:</p> -<figure class="highlight c"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><stdio.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><stdlib.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><caml/misc.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><caml/callback.h></span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string"><caml/threads.h></span></span></span><br><span class="line"></span><br><span class="line"><span class="type">int</span></span><br><span class="line"><span class="title function_">main</span> <span class="params">(<span class="type">int</span> argc, <span class="type">char</span> *argv[])</span></span><br><span class="line"> {</span><br><span class="line"> <span class="built_in">fprintf</span> (<span class="built_in">stderr</span>, <span class="string">"starting up ...\n"</span>);</span><br><span class="line"> caml_startup (argv);</span><br><span class="line"> <span class="built_in">fprintf</span> (<span class="built_in">stderr</span>, <span class="string">"acquiring ...\n"</span>);</span><br><span class="line"> caml_acquire_runtime_system ();</span><br><span class="line"> <span class="built_in">fprintf</span> (<span class="built_in">stderr</span>, <span class="string">"acquired\n"</span>);</span><br><span class="line"> <span class="comment">// here is where I would be calling an OCaml callback</span></span><br><span class="line"> <span class="comment">// omitted for simplicity</span></span><br><span class="line"> caml_release_runtime_system ();</span><br><span class="line"> <span class="built_in">exit</span> (<span class="number">0</span>);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure> - -<p>然后用OCaml5的ocaml native compiler编译一下(这里我用的是<code>ocaml-variants.5.0.0+options</code>):<br><code>ocamlopt -g test-ocaml-5.c test.ml -o test-ocaml-5</code></p> -<p>运行<code>test-ocaml-5</code> 会出现:</p> -<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">starting up ...</span><br><span class="line">hello from OCaml</span><br><span class="line">acquiring ...</span><br><span class="line">Fatal error: Fatal error during lock: Resource deadlock avoided</span><br><span class="line"></span><br><span class="line">[1] 8998 IOT instruction (core dumped) ./test-ocaml-5</span><br></pre></td></tr></table></figure> - -<p>这里我尝试了一下 4.14.0 和 4.14.1 , 都没有出现这个情况,而如果用<code>threads</code>编译的话:<br><code>ocamlopt -g -I +unix unix.cmxa -I +threads threads.cmxa test-ocaml-5.c test.ml -o test-ocaml-5</code></p> -<p>无论在5.0还是4.14.x,都会挂起。</p> -<p>出现这个问题的一个可能原因是,在<code>test-ocaml-5.c</code>中,我在开头调用了<code>caml_startup()</code>,这会让当前线程获取锁,而<code>caml_acquire_runtime_system()</code>会再次获取它,<code>caml_acquire_runtime_system()</code> 应该在<code>caml_release_runtime_system()</code>之后调用:</p> -<figure class="highlight ocaml"><table><tr><td class="code"><pre><span class="line"><span class="built_in">int</span></span><br><span class="line">main (<span class="built_in">int</span> argc, <span class="built_in">char</span> *argv<span class="literal">[]</span>)</span><br><span class="line"> {</span><br><span class="line"> fprintf (stderr, <span class="string">"starting up ...\n"</span>);</span><br><span class="line"> caml_startup (argv);</span><br><span class="line"> fprintf (stderr, <span class="string">"acquiring ...\n"</span>);</span><br><span class="line"> caml_release_runtime_system <span class="literal">()</span>;</span><br><span class="line"> caml_acquire_runtime_system <span class="literal">()</span>;</span><br><span class="line"> fprintf (stderr, <span class="string">"acquired\n"</span>);</span><br><span class="line"> exit (<span class="number">0</span>);</span><br><span class="line"> }</span><br></pre></td></tr></table></figure> - -<p>运行结果为:</p> -<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">starting up ...</span><br><span class="line">hello from OCaml</span><br><span class="line">acquiring ...</span><br><span class="line">acquired</span><br></pre></td></tr></table></figure>]]></content> - <tags> - <tag>Technique</tag> - <tag>OCaml</tag> - </tags> - </entry> - <entry> <title>使用 [@poll error] 实现线程安全的数据结构</title> <url>/2023/08/15/poll-error-attribute-in-OCaml/</url> <content><![CDATA[<p>OCaml的标准库提供了许多mutable的数据结构,比如Hashtbl, Queue, Stack之类的,但是这些数据结构都不是线程安全的。在 OCaml 4 和 OCaml 5 中,单个Domain中一次只能运行一个线程。换句话说,单个Domain中的线程仍然不会并行运行,除非在不同所的Domain中。</p> @@ -1313,6 +1313,20 @@ </categories> </entry> <entry> + <title>二〇二四年八月一日</title> + <url>/2024/08/02/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AB%E6%9C%88%E4%B8%80%E6%97%A5/</url> + <content><![CDATA[<p>我们之所以看到宇宙是这个样子,是因为如果它不是这样的话,我们就不会在这里去观察它。</p> +<p>如果我们仔细思考关于可能存在的宇宙的巨大迷宫,<br>我们就会发现大部分宇宙没有适合生命生产的条件,<br>哪怕任何与已知生命相近的东西,<br>以世人所熟悉的物理剧变来说,<br>这一点再清晰不过了,<br>If our universe didn’t conform to the rules it does,<br>Life as we know it would not exist,<br>哪怕是不那么激烈的物理变化也会干扰星球的形成,<br>比如,<br>扰乱他们作为宇宙熔炉的能力,<br>即合成维系生命的复杂的原子,<br>如碳原子,氧原子,<br>而碳氧原子通常是因超新星爆炸喷涌而出,<br>并散布在整个宇宙中的,<br>鉴于生命高度依赖于物理的各个细支,<br>如果我们现在发问,比如,<br>为什么自然中的各种力和粒子有我们观察到的各种特定属性组合,<br>一个合理的答案,<br>越过所有的可能性闪现出来,<br>这些特点各有不同,<br>属性也各有不同,<br>What’s special about the particular combination of particle and force properties we observe,<br>Is that clearly they allow life to form,<br>而生命,尤其是有智慧的生命,<br>是得以思考宇宙有如此属性,<br>的先决条件,<br>简单来说,<br>事物生来便是如此,<br>Because if they weren’t,<br>We wouldnt be here to notice,</p> +<p>If we weren’t here,<br>There’d be no one to see。</p> +<p>政治和工业的缺失,<br>诸神危机,<br>短浅目光,<br>停止怀疑其真伪,<br>你的敬畏感,<br>你的惊奇感,<br>面对这一切时丝毫无损,<br>也许适时的,<br>会有人听到这段残声,<br>这段无主题的演讲。</p> +<hr> +<p>阿公烧烟成老瘾,<br>阿公饮酒会面红,<br>他说日子要开心,<br>他说人生要尽兴。</p> +]]></content> + <categories> + <category>gallery</category> + </categories> + </entry> + <entry> <title>二〇二四年六月二十七日</title> <url>/2024/06/27/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E5%85%AD%E6%9C%88%E4%BA%8C%E5%8D%81%E4%B8%83%E6%97%A5/</url> <content><