in reply to Re^7: OT: Why does malloc always give me 24?
in thread OT: Why does malloc always give me 24? [SOLVED]
"…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 */
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: OT: Why does malloc always give me 24?
by NERDVANA (Priest) on Aug 23, 2024 at 22:07 UTC | |
by karlgoethebier (Abbot) on Aug 25, 2024 at 09:55 UTC |