aboutsummaryrefslogtreecommitdiff
path: root/stdlib/channels.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-01-02 16:24:07 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-01-02 16:24:07 -0500
commitbe384c0caa92cb152c264125fb265373e6a50440 (patch)
treeb823fb0dd4cfec643670236688a2a7ca76787d7b /stdlib/channels.h
parent2fcf1939bb295887592c1f24f7b8fbb10efcfcba (diff)
Replace threads with generic mutexed datastructures.
Diffstat (limited to 'stdlib/channels.h')
-rw-r--r--stdlib/channels.h45
1 files changed, 0 insertions, 45 deletions
diff --git a/stdlib/channels.h b/stdlib/channels.h
deleted file mode 100644
index cd0a82f8..00000000
--- a/stdlib/channels.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#pragma once
-
-// Functions that operate on channels (thread-safe arrays)
-
-#include <stdbool.h>
-
-#include "datatypes.h"
-#include "types.h"
-#include "util.h"
-
-Channel_t *Channel$new(Int_t max_size);
-void Channel$give(Channel_t *channel, const void *item, bool front, int64_t padded_item_size);
-#define Channel$give_value(channel, item, front, padded_item_size) \
- ({ __typeof(item) _item = item; Channel$give(channel, &_item, front, padded_item_size); })
-void Channel$give_all(Channel_t *channel, Array_t to_give, bool front, int64_t padded_item_size);
-void Channel$get(Channel_t *channel, void *out, bool front, int64_t item_size, int64_t padded_item_size);
-#define Channel$get_value(channel, front, t, padded_item_size) \
- ({ t _val; Channel$get(channel, &_val, front, sizeof(t), padded_item_size); _val; })
-void Channel$peek(Channel_t *channel, void *out, bool front, int64_t item_size);
-#define Channel$peek_value(channel, front, t) ({ t _val; Channel$peek(channel, &_val, front, sizeof(t)); _val; })
-void Channel$clear(Channel_t *channel);
-Array_t Channel$view(Channel_t *channel);
-PUREFUNC uint64_t Channel$hash(const void *channel, const TypeInfo_t *type);
-PUREFUNC int32_t Channel$compare(const void *x, const void *y, const TypeInfo_t *type);
-PUREFUNC bool Channel$equal(const void *x, const void *y, const TypeInfo_t *type);
-Text_t Channel$as_text(const void *channel, bool colorize, const TypeInfo_t *type);
-PUREFUNC bool Channel$is_none(const void *obj, const TypeInfo_t*);
-void Channel$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t*);
-void Channel$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInfo_t*);
-
-#define Channel$metamethods ((metamethods_t){ \
- .as_text=Channel$as_text, \
- .compare=Channel$compare, \
- .equal=Channel$equal, \
- .hash=Channel$hash, \
- .is_none=Channel$is_none, \
- .serialize=Channel$serialize, \
- .deserialize=Channel$deserialize, \
-})
-
-#define Channel$info(item_info) &((TypeInfo_t){.size=sizeof(Channel_t), .align=__alignof__(Channel_t), \
- .tag=ChannelInfo, .ChannelInfo.item=item_info, \
- .metamethods=Channel$metamethods})
-
-// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0