Created
November 16, 2023 01:07
-
-
Save tonycoz/7ae969a9da084bfed71d888b74841931 to your computer and use it in GitHub Desktop.
newlocale_loop.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <locale.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
int main() { | |
char psstr[40]; | |
pid_t p = getpid(); | |
snprintf(psstr, sizeof(psstr), "ps -l -p %ld", (long)p); | |
for (int i = 0; i < 1000000; ++i) { | |
if (i % 100000 == 0) | |
system(psstr); | |
locale_t l1 = newlocale(LC_ALL_MASK, "en_AU.UTF-8", (locale_t)0); | |
//locale_t old = uselocale(l1); | |
//uselocale(old); | |
freelocale(l1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment