{"id":2215,"date":"2024-06-04T09:30:20","date_gmt":"2024-06-04T01:30:20","guid":{"rendered":"https:\/\/sanlangcode.com\/?p=2215"},"modified":"2024-06-04T09:30:20","modified_gmt":"2024-06-04T01:30:20","slug":"ctaskscheduler-%e4%bb%bb%e5%8a%a1%e8%b0%83%e5%ba%a6%e5%99%a8%e7%9a%84%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"https:\/\/sanlangcode.com\/index.php\/2024\/06\/04\/ctaskscheduler-%e4%bb%bb%e5%8a%a1%e8%b0%83%e5%ba%a6%e5%99%a8%e7%9a%84%e5%8e%9f%e7%90%86\/","title":{"rendered":"C#TaskScheduler \u4efb\u52a1\u8c03\u5ea6\u5668\u7684\u539f\u7406"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4ec0\u4e48\u662fTaskScheduler\uff1f<\/h2>\n\n\n\n<p><br>SynchronizationContext\u662f\u5bf9\u201c\u8c03\u5ea6\u7a0b\u5e8f\uff08scheduler\uff09\u201d\u7684\u901a\u7528\u62bd\u8c61\u3002\u4e2a\u522b\u6846\u67b6\u4f1a\u6709\u81ea\u5df1\u7684\u62bd\u8c61\u8c03\u5ea6\u7a0b\u5e8f\uff0c\u6bd4\u5982System.Threading.Tasks\u3002\u5f53Tasks\u901a\u8fc7\u59d4\u6258\u7684\u5f62\u5f0f\u8fdb\u884c\u6392\u961f\u548c\u6267\u884c\u65f6\uff0c\u4f1a\u7528\u5230System.Threading.Tasks.TaskScheduler\u3002\u548cSynchronizationContext\u63d0\u4f9b\u4e86\u4e00\u4e2avirtual Post\u65b9\u6cd5\u7528\u4e8e\u5c06\u59d4\u6258\u6392\u961f\u8c03\u7528\u4e00\u6837\uff08\u7a0d\u540e\uff0c\u6211\u4eec\u4f1a\u901a\u8fc7\u5178\u578b\u7684\u59d4\u6258\u8c03\u7528\u673a\u5236\u6765\u8c03\u7528\u59d4\u6258\uff09\uff0cTaskScheduler\u4e5f\u63d0\u4f9b\u4e86\u4e00\u4e2aabstract QueueTask\u65b9\u6cd5\uff08\u7a0d\u540e\uff0c\u6211\u4eec\u4f1a\u901a\u8fc7ExecuteTask\u65b9\u6cd5\u6765\u8c03\u7528\u8be5Task\uff09\u3002<br><br>\u901a\u8fc7TaskScheduler.Default\u6211\u4eec\u53ef\u4ee5\u83b7\u53d6\u5230Task\u9ed8\u8ba4\u7684\u8c03\u5ea6\u7a0b\u5e8fThreadPoolTaskScheduler\u2014\u2014\u7ebf\u7a0b\u6c60\uff08\u8bd1\u6ce8\uff1a\u8fd9\u4e0b\u77e5\u9053\u4e3a\u4ec0\u4e48Task\u9ed8\u8ba4\u4f7f\u7528\u7684\u662f\u7ebf\u7a0b\u6c60\u7ebf\u7a0b\u4e86\u5427\uff09\u3002\u5e76\u4e14\u53ef\u4ee5\u901a\u8fc7\u7ee7\u627fTaskScheduler\u6765\u91cd\u5199\u76f8\u5173\u65b9\u6cd5\u6765\u5b9e\u73b0\u5728\u4efb\u610f\u65f6\u95f4\u4efb\u610f\u5730\u70b9\u8fdb\u884cTask\u8c03\u7528\u3002\u4f8b\u5982\uff0c\u6838\u5fc3\u5e93\u4e2d\u6709\u4e2a\u7c7b\uff0c\u540d\u4e3aSystem.Threading.Tasks.ConcurrentExclusiveSchedulerPair\uff0c\u5176\u5b9e\u4f8b\u516c\u5f00\u4e86\u4e24\u4e2aTaskScheduler\u5c5e\u6027\uff0c\u4e00\u4e2a\u53ebExclusiveScheduler\uff0c\u53e6\u4e00\u4e2a\u53ebConcurrentScheduler\u3002\u8c03\u5ea6\u7ed9ConcurrentScheduler\u7684\u4efb\u52a1\u53ef\u4ee5\u5e76\u53d1\uff0c\u4f46\u662f\u8981\u5728\u6784\u9020ConcurrentExclusiveSchedulerPair\u65f6\u5c31\u8981\u6307\u5b9a\u6700\u5927\u5e76\u53d1\u6570\uff08\u7c7b\u4f3c\u4e8e\u524d\u9762\u6f14\u793a\u7684MaxConcurrencySynchronizationContext\uff09\uff1b\u76f8\u53cd\uff0c\u5728ExclusiveScheduler\u6267\u884c\u4efb\u52a1\u65f6\uff0c\u90a3\u4e48\u5c06\u53ea\u5141\u8bb8\u8fd0\u884c\u4e00\u4e2a\u6392\u4ed6\u4efb\u52a1\uff0c\u8fd9\u4e2a\u884c\u4e3a\u5f88\u50cf\u8bfb\u5199\u9501\u3002<br><br>\u548cSynchronizationContext\u4e00\u6837\uff0cTaskScheduler\u4e5f\u6709\u4e00\u4e2aCurrent\u5c5e\u6027\uff0c\u4f1a\u8fd4\u56de\u5f53\u524d\u8c03\u5ea6\u7a0b\u5e8f\u3002\u4e0d\u8fc7\uff0c\u548cSynchronizationContext\u4e0d\u540c\u7684\u662f\uff0c\u5b83\u6ca1\u6709\u8bbe\u7f6e\u5f53\u524d\u8c03\u5ea6\u7a0b\u5e8f\u7684\u65b9\u6cd5\uff0c\u800c\u662f\u5728\u542f\u52a8Task\u65f6\u5c31\u8981\u63d0\u4f9b\uff0c\u56e0\u4e3a\u5f53\u524d\u8c03\u5ea6\u7a0b\u5e8f\u662f\u4e0e\u5f53\u524d\u8fd0\u884c\u7684Task\u76f8\u5173\u8054\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using System;\nusing System.Threading.Tasks;\n\nclass Program\n{\n    static void Main()\n    {\n        var cesp = new ConcurrentExclusiveSchedulerPair();\n        Task.Factory.StartNew(() =>\n        {\n            Console.WriteLine(TaskScheduler.Current == cesp.ExclusiveScheduler);\n        }, default, TaskCreationOptions.None, cesp.ExclusiveScheduler)\n        .Wait();\n    }\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/sanlangcode.com\/wp-content\/uploads\/2024\/06\/Snipaste_2024-06-04_09-27-34-1.png\" alt=\"\" class=\"wp-image-2218\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>public abstract class TaskScheduler\n{\n    \/\/ \u4efb\u52a1\u5165\u53e3\uff0c\u5f85\u8c03\u5ea6\u6267\u884c\u7684 Task \u4f1a\u901a\u8fc7\u8be5\u65b9\u6cd5\u4f20\u5165\uff0c\u8c03\u5ea6\u5668\u4f1a\u5c06\u4efb\u52a1\u5b89\u6392task\u5230\u6307\u5b9a\u7684\u961f\u5217\uff08\u7ebf\u7a0b\u6c60\u4efb\u52a1\u961f\u5217\uff08\u5168\u5c40\u4efb\u52a1\u961f\u5217\u3001\u672c\u5730\u961f\u5217\uff09\u3001\u72ec\u7acb\u7ebf\u7a0b\u3001ui\u7ebf\u7a0b\uff09 \u53ea\u80fd\u88ab.NET Framework\u8c03\u7528\uff0c\u4e0d\u80fd\u914d\u6d3e\u751f\u7c7b\u8c03\u7528\n   \/\/\n    protected internal abstract void QueueTask(Task task);\n\n    \/\/ \u8fd9\u4e2a\u662f\u5728\u6267\u884c Task \u56de\u8c03\u7684\u65f6\u5019\u624d\u4f1a\u88ab\u6267\u884c\u5230\u7684\u65b9\u6cd5\uff0c\u653e\u5230\u540e\u9762\u518d\u8bb2\n    protected abstract bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued);\n  protected abstract bool TryExecuteTask(Task task, bool taskWasPreviouslyQueued);\n\/\/ \u83b7\u53d6\u6240\u6709\u8c03\u5ea6\u5230\u8be5 TaskScheduler \u7684 Task\n\n protected abstract IEnumerable&lt;Task>? GetScheduledTasks();\n }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">&nbsp;.net\u4e2d\u7684\u4efb\u52a1\u8c03\u5ea6\u5668\u6709\u54ea\u4e9b<\/h2>\n\n\n\n<p>\u7ebf\u7a0b\u6c60\u4efb\u52a1\u8c03\u5ea6\u5668\uff1aThreadPoolTaskScheduler\u3001<br>\u6838\u5fc3\u5e93\u4efb\u52a1\u8c03\u5ea6\u5668\uff1aConcurrentExclusiveSchedulerPair<br>UI\u4efb\u52a1\u8c03\u5ea6\u5668\uff1aSynchronizationContextTaskScheduler\uff0c\u5e76\u53d1\u5ea6\u4e3a1<\/p>\n\n\n\n<p>\u5e73\u65f6\u6211\u4eec\u5728\u7528\u591a\u7ebf\u7a0b\u5f00\u53d1\u7684\u65f6\u5019\u5c11\u4e0d\u4e86Task\uff0c\u786e\u5b9etask\u7ed9\u6211\u4eec\u5e26\u6765\u4e86\u5de8\u5927\u7684\u7f16\u7a0b\u6548\u7387\uff0c\u5728Task\u5e95\u5c42\u6709\u4e00\u4e2aTaskScheduler\uff0c\u5b83\u51b3\u5b9a\u4e86task\u8be5\u5982\u4f55\u88ab\u8c03\u5ea6\uff0c\u800c<\/p>\n\n\n\n<p>\u5728.net framework\u4e2d\u6709\u4e24\u79cd\u7cfb\u7edf\u5b9a\u4e49Scheduler\uff0c\u7b2c\u4e00\u4e2a\u662fTask\u9ed8\u8ba4\u7684ThreadPoolTaskScheduler\uff0c\u8fd8\u662f\u4e00\u79cd\u5c31\u662fSynchronizationContextTaskScheduler\uff08wpf\uff09\uff0c\u9ed8\u8ba4\u7684\u8c03\u5ea6\u5668\u65e0\u6cd5\u63a7\u5236\u4efb\u52a1\u4f18\u5148\u7ea7\uff0c\u90a3\u4e48\u9700\u8981\u81ea\u5b9a\u4e49\u8c03\u5ea6\u5668\u5b9e\u73b0\u4f18\u5148\u7ea7\u63a7\u5236\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/sanlangcode.com\/wp-content\/uploads\/2024\/06\/Snipaste_2024-06-04_09-30-55-1024x833.png\" alt=\"\" class=\"wp-image-2221\"\/><\/figure>\n\n\n\n<p>\u8fd9\u79cdscheduler\u673a\u5236\u662ftask\u7684\u9ed8\u8ba4\u673a\u5236\uff0c\u800c\u4e14\u4ece\u540d\u5b57\u4e0a\u4e5f\u53ef\u4ee5\u770b\u5230\u5b83\u662f\u4e00\u79cd\u59d4\u6258\u5230ThreadPool\u7684\u673a\u5236\uff0c\u521a\u597d\u4e5f\u4ece\u4fa7\u9762\u8bf4\u660etask\u662f\u57fa\u4e8eThreadPool\u57fa\u7840\u4e0a\u7684\u5c01\u88c5\uff0cThreadPoolTaskScheduler\u7684\u539f\u7406\uff1a\u5c06\u6307\u5b9a\u7684\u957f\u4efb\u52a1\u5f00\u8f9f\u4e00\u4e2a\u72ec\u7acb\u7684\u7ebf\u7a0b\u53bb\u6267\u884c\uff0c\u672a\u6307\u5b9a\u7684\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u4efb\u52a1\u5c31\u7528\u7ebf\u7a0b\u6c60\u7684\u7ebf\u7a0b\u6267\u884c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>internal sealed class ThreadPoolTaskScheduler : TaskScheduler\n    {\n\/\/\u5176\u4ed6\u4ee3\u7801\n   protected internal override void QueueTask(Task task)\n        {\n            TaskCreationOptions options = task.Options;\n            if (Thread.IsThreadStartSupported &amp;&amp; (options &amp; TaskCreationOptions.LongRunning) != 0)\n            {\n                \/\/ Run LongRunning tasks on their own dedicated thread.\n                new Thread(s_longRunningThreadWork)\n                {\n                    IsBackground = true,\n                    Name = \".NET Long Running Task\"\n                }.UnsafeStart(task);\n            }\n            else\n            {\n                \/\/ Normal handling for non-LongRunning tasks.\n                ThreadPool.UnsafeQueueUserWorkItemInternal(task, (options &amp; TaskCreationOptions.PreferFairness) == 0);\n            }\n        }\n\/\/\u5176\u4ed6\u4ee3\u7801\n \n }<\/code><\/pre>\n\n\n\n<p>\u4e8c\uff1aSynchronizationContextTaskScheduler<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u6761\u4ef6\uff1a<\/strong>\u53ea\u6709\u5f53\u524d\u7a0b\u7684\u540c\u6b65\u4e0a\u4e0b\u6587\u4e0d\u4e3anull\u65f6\uff0c\u8be5\u65b9\u6cd5\u624d\u80fd\u6b63\u5e38\u4f7f\u7528\u3002\u4f8b\u5982\u5728UI\u7ebf\u7a0b\uff08wpf\u3001 winform\u3001 asp.net\uff09\u4e2d\uff0cUI\u7ebf\u7a0b\u7684\u540c\u6b65\u4e0a\u4e0b\u6587\u4e0d\u4e3aNull\u3002\u63a7\u5236\u53f0\u9ed8\u8ba4\u7684\u5f53\u524d\u7ebf\u7a0b\u540c\u6b65\u4e0a\u4e0b\u6587\u4e3anull\uff0c\u5982\u679c\u7ed9\u5f53\u524d\u7ebf\u7a0b\u8bbe\u7f6e\u9ed8\u8ba4\u7684\u540c\u6b65\u4e0a\u4e0b\u6587SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());\u5c31\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u8be5\u65b9\u6cd5\u3002\u5982\u679c\u63a7\u5236\u53f0\u7a0b\u5e8f\u7684\u7ebf\u7a0b\u672a\u8bbe\u7f6e\u540c\u6b65\u4e0a\u4e0b\u5c06\u5f15\u53d1\u3010\u5f53\u524d\u7684 SynchronizationContext \u4e0d\u80fd\u7528\u4f5c TaskScheduler\u3011\u5f02\u5e38\u3002<\/p>\n\n\n\n<p>\u9ed8\u8ba4\u7684\u540c\u6b65\u4e0a\u4e0b\u6587\u5c06\u65b9\u6cd5\u59d4\u6258\u7ed9\u7ebf\u7a0b\u6c60\u6267\u884c\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u65b9\u5f0f\uff1a<\/strong>\u901a\u8fc7TaskScheduler.FromCurrentSynchronizationContext() \u8c03\u7528SynchronizationContextTaskScheduler\u3002<\/p>\n\n\n\n<p><strong>\u539f\u7406\uff1a<\/strong>\u521d\u59cb\u5316\u65f6\u5019\u6355\u83b7\u5f53\u524d\u7684\u7ebf\u7a0b\u7684\u540c\u6b65\u4e0a\u4e0b\u6587<strong>\u3002&nbsp;<\/strong>\u5c06\u540c\u6b65\u4e0a\u4e0b\u6587\u5c01\u88c5\u5165\u4efb\u52a1\u8c03\u5ea6\u5668\u5f62\u6210\u65b0\u7684\u4efb\u52a1\u8c03\u5ea6\u5668SynchronizationContextTaskScheduler\u3002\u91cd\u5199\u8be5\u4efb\u52a1\u8c03\u5ea6\u5668\u4e2d\u7684QueueTask\u65b9\u6cd5\uff0c\u5229\u7528\u540c\u6b65\u4e0a\u4e0b\u6587\u7684post\u65b9\u6cd5\u5c06\u4efb\u52a1\u9001\u5230\u4e0d\u540c\u7684\u5904\u7406\u7a0b\u5e8f\uff0c\u5982\u679c\u662f<\/p>\n\n\n\n<p>winform\u7684UI\u7ebf\u7a0b\u540c\u6b65\u4e0a\u4e0b\u6587 \u7684post\u65b9\u6cd5\uff08\u5df2\u91cd\u5199post\u65b9\u6cd5\uff09\uff0c\u5c31\u5c06\u4efb\u52a1\u9001\u5230UI\u7ebf\u7a0b\u3002\u5982\u679c\u662f\u63a7\u5236\u53f0\u7ebf\u7a0b\uff08\u9ed8\u8ba4\u4e3anull \u8bbe\u7f6e\u9ed8\u8ba4\u540c\u6b65\u4e0a\u4e0b\u6587\u540e\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u3002\u9ed8\u8ba4\u540c\u6b65\u4e0a\u4e0b\u6587\u91c7\u7528\u7ebf\u7a0b\u6c60\u7ebf\u7a0b\uff09\u5c31\u5c06\u4efb\u52a1\u9001\u5165\u7ebf\u7a0b\u6c60\u5904\u7406\u3002<\/p>\n\n\n\n<p>\u5728winform\u4e2d\u7684\u540c\u6b65\u4e0a\u4e0b\u6587\uff1aWindowsFormsSynchronizationContext<br>\u5728wpf\u4e2d\u7684\u540c\u6b65\u4e0a\u4e0b\u6587\uff1aDispatcherSynchronizationContext<br>\u5728\u63a7\u5236\u53f0\\\u7ebf\u7a0b\u6c60\\new thread \u540c\u6b65\u4e0a\u4e0b\u6587\uff1a\u90fd\u9ed8\u8ba4\u4e3aNull\u3002\u53ef\u4ee5\u7ed9\u4ed6\u4eec\u8bbe\u7f6e\u9ed8\u8ba4\u7684\u540c\u6b65\u4e0a\u4e0b\u6587SynchronizationContext\u3002SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>internal sealed class SynchronizationContextTaskScheduler : TaskScheduler\n    {\n\n\/\/\u521d\u59cb\u5316\u65f6\u5019 \uff0c\u6355\u83b7\u5f53\u524d\u7ebf\u7a0b\u7684\u540c\u6b65\u4e0a\u4e0b\u6587  \n internal SynchronizationContextTaskScheduler()\n        {\n            m_synchronizationContext = SynchronizationContext.Current ??\n                \/\/ make sure we have a synccontext to work with\n                throw new InvalidOperationException(SR.TaskScheduler_FromCurrentSynchronizationContext_NoCurrent);\n        }\n\n\/\/\u5176\u4ed6\u4ee3\u7801\nprivate readonly SynchronizationContext m_synchronizationContext;\nprotected internal override void QueueTask(Task task)\n        {\n            m_synchronizationContext.Post(s_postCallback, (object)task);\n        }\n\/\/\u5176\u4ed6\u4ee3\u7801\n\/\/\/\u6539\u53d8post\u7684\u8c03\u5ea6\u65b9\u6cd5\u3001 \u8c03\u7528\u8005\u7ebf\u7a0b\u6267\u884c\u5404\u65b9\u9762\u7684\u4efb\u52a1\u64cd\u4f5c\n\n  private static readonly SendOrPostCallback s_postCallback = static s =>\n        {\n            Debug.Assert(s is Task);\n            ((Task)s).ExecuteEntry(); \/\/\u8c03\u7528\u8005\u7ebf\u7a0b\u6267\u884c\u5404\u65b9\u9762\u7684\u4efb\u52a1\u64cd\u4f5c\n        };\n }<\/code><\/pre>\n\n\n\n<p>\u4e09\uff1a\u81ea\u5b9a\u4e49TaskScheduler\u3000<\/p>\n\n\n\n<p>\u3000\u3000\u6211\u4eec\u77e5\u9053\u5728\u73b0\u6709\u7684.net framework\u4e2d\u53ea\u6709\u8fd9\u4e48\u4e24\u79cdTaskScheduler\uff0c\u6709\u4e9b\u540c\u5b66\u53ef\u80fd\u60f3\u95ee\uff0c\u8fd9\u4e9bScheduler\u6211\u7528\u8d77\u6765\u4e0d\u723d\uff0c\u6211\u60f3\u81ea\u5b9a\u4e49\u4e00\u4e0b\uff0c\u8fd9\u4e2a\u53ef<\/p>\n\n\n\n<p>\u4ee5\u5417\uff1f\u5f53\u7136\uff01\uff01\uff01\u5982\u679c\u4f60\u60f3\u81ea\u5b9a\u4e49\uff0c\u53ea\u8981\u81ea\u5b9a\u4e49\u4e00\u4e2a\u7c7b\u5b9e\u73b0\u4e00\u4e0bTaskScheduler\u5c31\u53ef\u4ee5\u4e86\uff0c\u7136\u540e\u4f60\u53ef\u4ee5\u5c06ThreadPoolTaskScheduler\u7b80\u5316\u4e00\u4e0b\uff0c\u5373\u6211\u8981<\/p>\n\n\n\n<p>\u6c42\u6240\u6709\u7684Task\u90fd\u9700\u8981\u8d70Thread\uff0c\u675c\u7edd\u4f7f\u7528TheadPool\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>namespace ConsoleApplication1\n{\n    class Program\n    {\n        static void Main(string&#91;] args)\n        {\n            var task = Task.Factory.StartNew(() =>\n            {\n                Console.WriteLine(\"hello world\uff01\uff01\uff01\");\n            }, new CancellationToken(), TaskCreationOptions.None, new PerThreadTaskScheduler());\n\n            Console.Read();\n        }\n    }\n\n    \/\/\/ &lt;summary>\n    \/\/\/ \u6bcf\u4e2aTask\u4e00\u4e2aThread\n    \/\/\/ &lt;\/summary>\n    public class PerThreadTaskScheduler : TaskScheduler\n    {\n        protected override IEnumerable&lt;Task> GetScheduledTasks()\n        {\n            return null;\n        }\n\n        protected override void QueueTask(Task task)\n        {\n            var thread = new Thread(() =>\n            {\n                TryExecuteTask(task);\n            });\n\n            thread.Start();\n        }\n\n        protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662fTaskScheduler&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2215","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/2215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/comments?post=2215"}],"version-history":[{"count":0,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/2215\/revisions"}],"wp:attachment":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media?parent=2215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/categories?post=2215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/tags?post=2215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}