Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
api:thread:zh [2023/10/20 11:14]
hfsr [Event Registration Independence]
api:thread:zh [2023/10/20 11:23]
hfsr [Functions]
Line 26: Line 26:
   * 被推送的事件对系统中的所有运行中线程可见。   * 被推送的事件对系统中的所有运行中线程可见。
   * 两个独立的线程可以对同一个事件`event.pull`,每个线程都会独立观测到此事件。   * 两个独立的线程可以对同一个事件`event.pull`,每个线程都会独立观测到此事件。
-===== Overview ​=====+===== 概述 ​=====
  
-There are two main use cases for using threads over other viable options+线程主要有两种用途是其他选择无法提供:
  
-You want to write a function that makes blocking calls without blocking the rest of your application. +你需要编写一个函数,其中进行了阻塞式调用,但不阻塞程序其它部分的运行。 
-You want a long running background function without having to manage yielding and resuming it manually.+你需要编写长期运行的后台函数,而不想手动管理其yield与resum。
  
-===== Functions ​=====+===== 函数 ​=====
  
-There are two sections of API defined here.+此处定义了两类API
  
-1. The [[api:​thread#​Thread_API|thread]] api, or the static functions, provided by `require("​thread"​)` +1. [[api:​thread:zh#线程API|线程]]API,或者说静态函数,由`require("​thread"​)`提供。 
-2. The [[api:​thread#​Thread_Handle_API|thread handle]] api, or the api available the thread _objects_ created by `thread.create`. In this documentation these thread handles will be denoted by just `t`.+2. [[api:​thread:zh#线程句柄API|线程句柄]]API,或者说适用于`thread.create`创建的线程_对象_的api。在此文档中这些线程句柄将会仅以`t`表示。
  
 ===== Thread API ===== ===== Thread API =====