1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-12 11:38:08 +00:00

Threading improvements.

- Add thread/exit to kill the current thread.
- Add global lock aroung custom getline and add atexit handler
- to prevent any possible issues when exiting program.
- Allow sending stderr, stdout, and stdin over thread.
This commit is contained in:
Calvin Rose
2020-07-03 16:19:05 -05:00
parent dc259b9f8e
commit 617ec7f565
5 changed files with 119 additions and 34 deletions

View File

@@ -1002,7 +1002,7 @@ struct JanetRNG {
typedef struct JanetFile JanetFile;
struct JanetFile {
FILE *file;
int flags;
int32_t flags;
};
/* Thread types */
@@ -1534,11 +1534,11 @@ extern JANET_API const JanetAbstractType janet_file_type;
#define JANET_FILE_SERIALIZABLE 128
#define JANET_FILE_PIPED 256
JANET_API Janet janet_makefile(FILE *f, int flags);
JANET_API FILE *janet_getfile(const Janet *argv, int32_t n, int *flags);
JANET_API Janet janet_makefile(FILE *f, int32_t flags);
JANET_API FILE *janet_getfile(const Janet *argv, int32_t n, int32_t *flags);
JANET_API FILE *janet_dynfile(const char *name, FILE *def);
JANET_API JanetAbstract janet_checkfile(Janet j);
JANET_API FILE *janet_unwrapfile(Janet j, int *flags);
JANET_API FILE *janet_unwrapfile(Janet j, int32_t *flags);
/* Marshal API */
JANET_API void janet_marshal_size(JanetMarshalContext *ctx, size_t value);