<commit_before>#ifndef     P7R_UTHREAD_H_
#define     P7R_UTHREAD_H_

#include    "./p7r_stdc_common.h"
#include    "./p7r_linux_common.h"
#include    "./p7r_scraft_common.h"

#include    "./p7r_timing.h"
#include    "./p7r_cpbuffer.h"
#include    "./p7r_stack_allocator.h"
#include    "./p7r_context.h"


struct p7r_uthread {
    uint32_t scheduler_index;
    struct p7r_context context;
    struct p7r_stack_metamark *stack_metamark;
    uint64_t status;
    struct {
        void (*user_entrance)(void *);
        void (*real_entrance)(void *);
        void *user_argument, *real_argument;
    } entrance;
    list_ctl_t linkable;
};

struct p7r_uthread_request {
    void (*user_entrance)(void *);
    void *user_argument;
    list_ctl_t linkable;
};

#define     P7R_UTHREAD_PRELAUNCH       0
#define     P7R_UTHREAD_RUNNING         1
#define     P7R_UTHREAD_LIMBO           2
#define     P7R_UTHREAD_DYING           3

struct p7r_timer_core {
    uint64_t timestamp;
    int triggered;
    struct p7r_uthread *uthread;
    struct scraft_rbtree_node maplink;
};

struct p7r_timer_queue {
    struct scraft_rbtree map;
};

struct p7r_delegation {
    int fd;
    struct p7r_uthread *uthread;
};

#define     P7R_N_SCHED_QUEUES          3
#define     P7R_SCHED_QUEUE_RUNNING     0
#define     P7R_SCHED_QUEUE_BLOCKING    1
#define     P7R_SCHED_QUEUE_DYING       2

struct p7r_scheduler {
    uint32_t index;
    uint32_t n_carriers;
    uint64_t status;
    struct {
        list_ctl_t request_queue;
        list_ctl_t sched_queues[P7R_N_SCHED_QUEUES];
        struct p7r_uthread *running;
        struct p7r_context *carrier_context;
        struct p7r_stack_allocator stack_allocator;
    } runners;
    struct {
        int fd_epoll;
        int fd_notification;
        struct p7r_delegation notification;
        int consumed;
        struct p7r_cpbuffer *message_boxes;
        struct p7r_timer_queue timers;
        struct epoll_event *epoll_events;
        int n_epoll_events;
    } bus;
};

#define     P7R_SCHEDULER_BORN          0
#define     P7R_SCHEDULER_ALIVE         1
#define     P7R_SCHEDULER_DYING         2

struct p7r_carrier {
    uint32_t index;
    pthread_t pthread_id;
    struct p7r_context context;
    struct p7r_scheduler *scheduler;
};

#define     P7R_INTERNAL_U2CC               0x1         // vs. IUC
#define     P7R_INTERNAL_ATTACHED           0x2         // vs. BUFFERED
#define     P7R_MESSAGE_UNDEFINED           (0 << 2)
#define     P7R_MESSAGE_UTHREAD_REQUEST     (1 << 2)

#define     P7R_MESSAGE_REAL_TYPE(type_)    (((type_) & ~3) >> 2)

struct p7r_internal_message {
    uint64_t type;
    uint32_t from, to;
    list_ctl_t linkable, communicatable;
    void (*content_destructor)(struct p7r_internal_message *);
    void *(*content_extractor)(struct p7r_internal_message *);
    char content_buffer;
} __attribute__((packed));

#define     P7R_BUFFERED_MESSAGE_SIZE(size_)    (sizeof(struct p7r_internal_message) - 1 + (size_))
#define     P7R_MESSAGE_OF(buffer_)             container_of(((char *) buffer_), struct p7r_internal_message, content_buffer)

#endif      // P7R_UTHREAD_H_
<commit_msg>Daily dev.<commit_after>#ifndef     P7R_UTHREAD_H_
#define     P7R_UTHREAD_H_

#include    "./p7r_stdc_common.h"
#include    "./p7r_linux_common.h"
#include    "./p7r_scraft_common.h"

#include    "./p7r_timing.h"
#include    "./p7r_cpbuffer.h"
#include    "./p7r_stack_allocator.h"
#include    "./p7r_context.h"


struct p7r_uthread {
    uint32_t scheduler_index;
    struct p7r_context context;
    struct p7r_stack_metamark *stack_metamark;
    uint64_t status;
    struct {
        void (*user_entrance)(void *);
        void (*real_entrance)(void *);
        void *user_argument, *real_argument;
    } entrance;
    list_ctl_t linkable;
};

struct p7r_uthread_request {
    void (*user_entrance)(void *);
    void *user_argument;
    list_ctl_t linkable;
};

#define     P7R_UTHREAD_PRELAUNCH       0
#define     P7R_UTHREAD_RUNNING         1
#define     P7R_UTHREAD_LIMBO           2
#define     P7R_UTHREAD_DYING           3

struct p7r_timer_core {
    uint64_t timestamp;
    int triggered;
    struct p7r_uthread *uthread;
    struct scraft_rbtree_node maplink;
};

struct p7r_timer_queue {
    struct scraft_rbtree map;
};

struct p7r_delegation {
    int fd;
    struct epoll_event epoll_event;
    struct p7r_uthread *uthread;
};

#define     P7R_N_SCHED_QUEUES          3
#define     P7R_SCHED_QUEUE_RUNNING     0
#define     P7R_SCHED_QUEUE_BLOCKING    1
#define     P7R_SCHED_QUEUE_DYING       2

struct p7r_scheduler {
    uint32_t index;
    uint32_t n_carriers;
    uint64_t status;
    struct {
        list_ctl_t request_queue;
        list_ctl_t sched_queues[P7R_N_SCHED_QUEUES];
        struct p7r_uthread *running;
        struct p7r_context *carrier_context;
        struct p7r_stack_allocator stack_allocator;
    } runners;
    struct {
        int fd_epoll;
        int fd_notification;
        struct p7r_delegation notification;
        int consumed;
        struct p7r_cpbuffer *message_boxes;
        struct p7r_timer_queue timers;
        struct epoll_event *epoll_events;
        int n_epoll_events;
    } bus;
};

#define     P7R_SCHEDULER_BORN          0
#define     P7R_SCHEDULER_ALIVE         1
#define     P7R_SCHEDULER_DYING         2

struct p7r_carrier {
    uint32_t index;
    pthread_t pthread_id;
    struct p7r_context context;
    struct p7r_scheduler *scheduler;
};

#define     P7R_INTERNAL_U2CC               0x1         // vs. IUC
#define     P7R_INTERNAL_ATTACHED           0x2         // vs. BUFFERED
#define     P7R_MESSAGE_UNDEFINED           (0 << 2)
#define     P7R_MESSAGE_UTHREAD_REQUEST     (1 << 2)

#define     P7R_MESSAGE_REAL_TYPE(type_)    (((type_) & ~3) >> 2)

struct p7r_internal_message {
    uint64_t type;
    uint32_t from, to;
    list_ctl_t linkable, communicatable;
    void (*content_destructor)(struct p7r_internal_message *);
    void *(*content_extractor)(struct p7r_internal_message *);
    char content_buffer;
} __attribute__((packed));

#define     P7R_BUFFERED_MESSAGE_SIZE(size_)    (sizeof(struct p7r_internal_message) - 1 + (size_))
#define     P7R_MESSAGE_OF(buffer_)             container_of(((char *) buffer_), struct p7r_internal_message, content_buffer)

#endif      // P7R_UTHREAD_H_

{'fraction_non_alphanumeric': 0.07715415019762846, 'fraction_numerical': 0.029723320158102768, 'mean_word_length': 2.7971188475390156, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '719410', 'n_tokens_mistral': 2413, 'n_tokens_neox': 2357, 'n_words': 444}