1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 01:37:19 +00:00

Set default channel size to 0.

This commit is contained in:
Calvin Rose 2020-08-03 07:57:02 -05:00
parent 5899671d96
commit cb898fabf4

View File

@ -521,7 +521,7 @@ static Janet cfun_channel_count(int32_t argc, Janet *argv) {
static Janet cfun_channel_new(int32_t argc, Janet *argv) { static Janet cfun_channel_new(int32_t argc, Janet *argv) {
janet_arity(argc, 0, 1); janet_arity(argc, 0, 1);
int32_t limit = janet_optnat(argv, argc, 0, 10); int32_t limit = janet_optnat(argv, argc, 0, 0);
JanetChannel *channel = janet_abstract(&ChannelAT, sizeof(JanetChannel)); JanetChannel *channel = janet_abstract(&ChannelAT, sizeof(JanetChannel));
janet_chan_init(channel, limit); janet_chan_init(channel, limit);
return janet_wrap_abstract(channel); return janet_wrap_abstract(channel);
@ -756,7 +756,7 @@ static const JanetReg ev_cfuns[] = {
"ev/chan", cfun_channel_new, "ev/chan", cfun_channel_new,
JDOC("(ev/chan &opt capacity)\n\n" JDOC("(ev/chan &opt capacity)\n\n"
"Create a new channel. capacity is the number of values to queue before " "Create a new channel. capacity is the number of values to queue before "
"blocking writers, defaults to 10 if not provided. Returns a new channel.") "blocking writers, defaults to 0 if not provided. Returns a new channel.")
}, },
{ {
"ev/give", cfun_channel_push, "ev/give", cfun_channel_push,