Skip to content

Commit c9b75e9

Browse files
authored
Merge pull request #147 from Zwlin98/master
Fix typos in code and documentation
2 parents 6a39d92 + 0b352de commit c9b75e9

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ltask is inspired by skynet (https://github.com/cloudwu/skynet) , but it's a lib
55

66
It implement an n:m scheduler , so that you can run M lua VMs on N OS threads.
77

8-
Each lua service (an indepentent lua VM) works in request/response mode, they use message channels to inter-communicate.
8+
Each lua service (an independent lua VM) works in request/response mode, they use message channels to inter-communicate.
99

1010
`root` is a special service that can spawn new services. For example,
1111

@@ -45,4 +45,4 @@ Test
4545
====
4646
```
4747
lua test.lua
48-
```
48+
```

lualib/bootstrap.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local boot = require "ltask.bootstrap"
22

33
local SERVICE_ROOT <const> = 1
4-
local MESSSAGE_SYSTEM <const> = 0
4+
local MESSAGE_SYSTEM <const> = 0
55

66
local function bootstrap_root(initfunc, config)
77
local sid = assert(boot.new_service("root", config.service_source, config.service_chunkname, SERVICE_ROOT))
@@ -18,7 +18,7 @@ local function bootstrap_root(initfunc, config)
1818
from = SERVICE_ROOT,
1919
to = SERVICE_ROOT,
2020
session = 1, -- 1 for root init
21-
type = MESSSAGE_SYSTEM,
21+
type = MESSAGE_SYSTEM,
2222
message = init_msg,
2323
size = sz,
2424
}

lualib/service.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ local function post_response_message(addr, session, type, msg, sz)
288288
end
289289
end
290290

291-
function ltask.rasie_error(addr, session, message)
291+
function ltask.raise_error(addr, session, message)
292292
if session == SESSION_SEND_MESSAGE then
293293
return
294294
end
@@ -702,7 +702,7 @@ function ltask.quit()
702702
ltask.fork(function ()
703703
for co, addr in pairs(session_coroutine_address) do
704704
local session = session_coroutine_response[co]
705-
ltask.rasie_error(addr, session, "Service has been quit.")
705+
ltask.raise_error(addr, session, "Service has been quit.")
706706
end
707707
quit = true
708708
end)

service/root.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ local MESSAGE_SCHEDULE_DEL <const> = 1
1212

1313
local RECEIPT_ERROR <const> = 2
1414
local RECEIPT_BLOCK <const> = 3
15-
local RECEIPT_RESPONCE <const> = 4
15+
local RECEIPT_RESPONSE <const> = 4
1616

1717
local S = {}
1818

@@ -117,7 +117,7 @@ end
117117

118118
local function spawn(t)
119119
local type, address = ltask.post_message(SERVICE_SYSTEM, 0, MESSAGE_SCHEDULE_NEW)
120-
if type ~= RECEIPT_RESPONCE then
120+
if type ~= RECEIPT_RESPONSE then
121121
-- RECEIPT_ERROR
122122
error("send MESSAGE_SCHEDULE_NEW failed.")
123123
end
@@ -244,7 +244,7 @@ local function del_service(address)
244244
for i=1, #msg, 2 do
245245
local addr = msg[i]
246246
local session = msg[i+1]
247-
ltask.rasie_error(addr, session, err)
247+
ltask.raise_error(addr, session, err)
248248
end
249249
end
250250
end

src/ltask.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ dispatch_schedule_message(struct ltask *task, service_id id, struct message *msg
150150
if (msg->to.id == 0) {
151151
service_write_receipt(P, id, MESSAGE_RECEIPT_ERROR, msg);
152152
} else {
153-
service_write_receipt(P, id, MESSAGE_RECEIPT_RESPONCE, msg);
153+
service_write_receipt(P, id, MESSAGE_RECEIPT_RESPONSE, msg);
154154
}
155155
break;
156156
case MESSAGE_SCHEDULE_DEL:
@@ -222,7 +222,7 @@ collect_done_job(struct ltask *task, service_id done_job[]) {
222222
}
223223

224224
static void
225-
dispath_out_messages(struct ltask *task, const service_id done_job[], int done_job_n) {
225+
dispatch_out_messages(struct ltask *task, const service_id done_job[], int done_job_n) {
226226
struct service_pool *P = task->services;
227227
int i;
228228

@@ -483,7 +483,7 @@ schedule_dispatch(struct ltask *task) {
483483
schedule_back(task, id);
484484
}
485485

486-
// Step 1 : dispatch external messsages
486+
// Step 1 : dispatch external messages
487487

488488
if (task->external_message) {
489489
dispatch_external_messages(task);
@@ -495,7 +495,7 @@ schedule_dispatch(struct ltask *task) {
495495
int done_job_n = collect_done_job(task, jobs);
496496

497497
// Step 3: Dispatch out message by service_done
498-
dispath_out_messages(task, jobs, done_job_n);
498+
dispatch_out_messages(task, jobs, done_job_n);
499499

500500
// Step 4: get pending jobs
501501
int job_n = get_pending_jobs(task, jobs);
@@ -857,7 +857,7 @@ ltask_init(lua_State *L) {
857857
static void *
858858
get_ptr(lua_State *L, const char *key) {
859859
if (lua_getfield(L, LUA_REGISTRYINDEX, key) == LUA_TNIL) {
860-
luaL_error(L, "%s is absense", key);
860+
luaL_error(L, "%s is absence", key);
861861
return NULL;
862862
}
863863
void * v = lua_touserdata(L, -1);
@@ -984,10 +984,10 @@ ltask_deinit(lua_State *L) {
984984

985985
int i;
986986
for (i=0;i<task->config->worker;i++) {
987-
worker_destory(&task->workers[i]);
987+
worker_destroy(&task->workers[i]);
988988
}
989989

990-
service_destory(task->services);
990+
service_destroy(task->services);
991991
queue_delete(task->schedule);
992992
timer_destroy(task->timer);
993993

@@ -1419,7 +1419,7 @@ lmessage_receipt(lua_State *L) {
14191419
lua_pushinteger(L, receipt);
14201420
if (m == NULL)
14211421
return 1;
1422-
if (receipt == MESSAGE_RECEIPT_RESPONCE) {
1422+
if (receipt == MESSAGE_RECEIPT_RESPONSE) {
14231423
// Only for schedule message NEW
14241424
lua_pushinteger(L, m->to.id);
14251425
message_delete(m);

src/message.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef unsigned int session_t;
1717
#define MESSAGE_RECEIPT_DONE 1
1818
#define MESSAGE_RECEIPT_ERROR 2
1919
#define MESSAGE_RECEIPT_BLOCK 3
20-
#define MESSAGE_RECEIPT_RESPONCE 4
20+
#define MESSAGE_RECEIPT_RESPONSE 4
2121

2222
// If to == 0, it's a schedule message. It should be post from root service (1).
2323
// type is MESSAGE_SCHEDULE_* from is the parameter (for DEL service_id).

src/service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ free_service(struct service *S) {
113113
}
114114

115115
void
116-
service_destory(struct service_pool *p) {
116+
service_destroy(struct service_pool *p) {
117117
if (p == NULL)
118118
return;
119119
int i;

src/service.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ typedef struct {
2626
} service_id;
2727

2828
struct service_pool * service_create(struct ltask_config *config);
29-
void service_destory(struct service_pool *p);
29+
void service_destroy(struct service_pool *p);
3030
service_id service_new(struct service_pool *p, unsigned int id);
3131
// 0 succ
3232
int service_init(struct service_pool *p, service_id id, void *ud, size_t sz, void *pL);

src/worker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ worker_quit(struct worker_thread *w) {
103103
}
104104

105105
static inline void
106-
worker_destory(struct worker_thread *worker) {
106+
worker_destroy(struct worker_thread *worker) {
107107
cond_release(&worker->trigger);
108108
}
109109

@@ -131,7 +131,7 @@ worker_assign_job(struct worker_thread *worker, service_id id) {
131131
if (q->head == q->tail)
132132
q->head = q->tail = 0;
133133
}
134-
// only one producer (Woker) except itself (worker_steal_job), so don't need use CAS to set
134+
// only one producer (Worker) except itself (worker_steal_job), so don't need use CAS to set
135135
worker->service_ready = id.id;
136136
return id;
137137
} else {

0 commit comments

Comments
 (0)