[-] [email protected] 4 points 2 weeks ago* (last edited 2 weeks ago)

Nobody who matters judges new shoes, but you can also extend the life of your shoes by resoling them before they get torn up. https://rockandresole.com/ does mail in resoling, but there could be a place near you. Huge savings considering the cost of shoes these days. I have a few pairs I rotate through while some are being resoled

[-] [email protected] 2 points 1 month ago* (last edited 1 month ago)

You can use ~/.local/lib and LD_LIBRARY_PATH for shared libs.

Or better yet just give in and use the nix package manager, it is basically a virtual environment for your C programs.

[-] [email protected] 4 points 2 months ago* (last edited 2 months ago)

Yes for example Python implements them using semaphores.

[-] [email protected] 11 points 2 months ago

It doesn't violate any rules.. Imagine both the "speaker" and the "text" are being updated by separate threads. A program that would eventually display the behavior in this meme is simple, and I'm a bit embarrassed to have written it because of this comment:

#include <pthread.h>
#include <stdio.h>

char* speakers[] = {
    "Alice",
    "Bob"
};
int speaker = 0;

void* change_speaker(void* arg)
{
    (void)arg;

    for (;;) {
        speaker = speaker == 0 ? 1 : 0;
    }
}

char* texts[] = {
    "Hi Bob",
    "Hi Alice, what's up?",
    "Not much Bob",
};
int text = 0;

void* change_text(void* arg)
{
    (void)arg;
    for (;;) {
        switch (text) {
        case 0:
            text = 1;
            break;
        case 1:
            text = 2;
            break;
        case 2:
            text = 0;
            break;
        }
    }
}

int main(int argc, char* argv[])
{
    pthread_t speaker_swapper, text_swapper;

    pthread_create(&text_swapper, NULL, change_text, NULL);
    pthread_create(&speaker_swapper, NULL, change_speaker, NULL);
    for (int i = 0; i < 3; ++i) {
        printf("%s: %s\n", speakers[speaker], texts[text]);
    }
}

qqq

joined 1 year ago