Skip to content

Commit

Permalink
chore: queue_usable api
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaozg committed Feb 23, 2024
1 parent d0469bd commit ecc558f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .ci/docscov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [[ ! -f src/luv.c ]] ; then
exit 1
fi

func_definitions=$(sed -n '/luaL_Reg luv_functions\[\] = {$/,/^};$/{p;/^\};$/q}' src/luv.c)
func_definitions=$(gsed -n '/luaL_Reg luv_functions\[\] = {$/,/^};$/{p;/^\};$/q}' src/luv.c)
funcs_start_line_number=$(awk '/luaL_Reg luv_functions\[\] = \{/ {print FNR}' src/luv.c)
after_funcs=$((funcs_start_line_number+1))
method_definitions=$(tail -n +$after_funcs src/luv.c | sed -n '/luaL_Reg/,/^\};$/p')
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ "master" ]
branches: [ "extend" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
branches: [ "extend" ]
paths-ignore:
- 'deps/'
schedule:
Expand Down
13 changes: 12 additions & 1 deletion docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ See Libuv's [Error constants](https://docs.libuv.org/en/v1.x/errors.html#error-c
- `EMSGSIZE`: message too long.
- `ENAMETOOLONG`: name too long.
- `ENETDOWN`: network is down.
- `ENETUNREACH`: network is unreachable.
- `ENETUNREACH`: [network](2024-02-23_network.md) is unreachable.
- `ENFILE`: file table overflow.
- `ENOBUFS`: no buffer space available.
- `ENODEV`: no such device.
Expand Down Expand Up @@ -3243,6 +3243,17 @@ called in the main loop thread.

**Returns:** `boolean` or `fail`

### `uv.queue_usable()`

> method from `work_ctx:usable()`
**Parameters:**
- `work_ctx`: `luv_work_ctx_t userdata`

Check weather queue usable.

**Returns:** `boolean`

## DNS utility functions

[DNS utility functions]: #dns-utility-functions
Expand Down
2 changes: 2 additions & 0 deletions src/work.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,10 @@ static int luv_queue_work(lua_State* L) {
}

static int luv_queue_usable(lua_State* L) {
uv_mutex_lock(&vm_mutex);
lua_pushboolean(L, running >=0 && running + 1 < nvms);
lua_pushinteger(L, running);
uv_mutex_unlock(&vm_mutex);
return 2;
};

Expand Down

0 comments on commit ecc558f

Please sign in to comment.