aboutsummaryrefslogtreecommitdiff
path: root/builtins/channel.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-13 03:27:32 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-13 03:27:32 -0400
commiteb9e5260a627191d255b30e43ff239dbf4b11faa (patch)
treedde596b0a52be417419280db8cc82adafb5002e3 /builtins/channel.c
parentcf8c01845e67e9cee6d70917273ab8060cc90372 (diff)
Fix channels
Diffstat (limited to 'builtins/channel.c')
-rw-r--r--builtins/channel.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtins/channel.c b/builtins/channel.c
index e4683aa3..dba50115 100644
--- a/builtins/channel.c
+++ b/builtins/channel.c
@@ -14,18 +14,19 @@
#include "array.h"
#include "functions.h"
#include "halfsiphash.h"
+#include "integers.h"
#include "types.h"
#include "util.h"
-public channel_t *Channel$new(int64_t max_size)
+public channel_t *Channel$new(Int_t max_size)
{
- if (max_size <= 0)
+ if (Int$compare_value(max_size, I(0)) <= 0)
fail("Cannot create a channel with a size less than one: %ld", max_size);
channel_t *channel = new(channel_t);
channel->items = (array_t){};
channel->mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
channel->cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
- channel->max_size = max_size;
+ channel->max_size = Int$as_i64(max_size);
return channel;
}