"…each thread gets its own data”
That is probably the obvious.
”…they exchange ownership of the whole structure via passing a pointer through a pipe"
Any links to instructive examples are gladly accepted.
Links for thread victims:
Update: Perhaps a solution?
Update 2: …seems to be incomplete…last update 10 years ago or so
#include <dispatch/dispatch.h> #include <err.h> #include <stdio.h> #include <stdlib.h> int main(void) { dispatch_queue_t gizmo; dispatch_time_t wait; gizmo = dispatch_get_main_queue(); wait = dispatch_time(DISPATCH_TIME_NOW, 1LL * NSEC_PER_SEC); dispatch_after(wait, gizmo, ^{ printf("Super Karl\n"); exit(0); }); dispatch_main(); return (0); } /* scons: Reading SConscript files ... */ /* scons: done reading SConscript files. */ /* scons: Building targets ... */ /* clang -pthread -g -fsanitize=address -fsanitize=undefined -fsanitiz +e=float-divide-by-zero -fb\ locks -o containers/obj/gcd.o -c -std=c17 -O3 -Wall -I_include -Iconta +iners/include -Iinclude co\ ntainers/src/gcd.c */ /* clang -pthread -g -fsanitize=address -fsanitize=undefined -fsanitiz +e=float-divide-by-zero -fb\ locks -o containers/bin/gcd -Wl -fuse-ld=lld containers/obj/gcd.o -lBl +ocksRuntime -ldispatch */ /* scons: done building targets. */ /* karl@rantanplan:~/src/myC/testomato$ containers/bin/gcd */ /* Super Karl */
In reply to Re^8: OT: Why does malloc always give me 24?
by karlgoethebier
in thread OT: Why does malloc always give me 24? [SOLVED]
by karlgoethebier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |