initial commit

Signed-off-by: Aleksey Selihov <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-05-22 02:40:32 +03:00
commit bba5c8a39a
109 files changed
+14085

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
#include <pthread.h>
#include <stdint.h>
static void* worker(void* arg) {
return (void*)((intptr_t)arg * 2);
}
// Returns (input * 2) computed inside a spawned pthread.
int pthread_double(int x) {
pthread_t tid;
if (pthread_create(&tid, NULL, worker, (void*)(intptr_t)x) != 0)
return -1;
void* ret = NULL;
if (pthread_join(tid, &ret) != 0)
return -2;
return (int)(intptr_t)ret;
}