Increment a shared counter with atomic_fetch_add_explicit
Increment a shared counter from several threads with C11 atomic_fetch_add_explicit and memory_order_relaxed, which also returns the old value.
Short posts that solve one thing: the code, the output we got, and why it works.
Increment a shared counter from several threads with C11 atomic_fetch_add_explicit and memory_order_relaxed, which also returns the old value.
Open a media file in C with avformat_open_input from libavformat 61 (FFmpeg 7.1), check the negative error code, and release it with avformat_close_input.
Count instructions only inside one function by passing --toggle-collect=compute to callgrind, so setup code stays out of the profile.
Turn on the Raspberry Pi I2C bus in a Yocto Scarthgap image with ENABLE_I2C in local.conf, which writes the dtparam line for you.
Read the bytes currently free in the FreeRTOS heap with xPortGetFreeHeapSize, a total across all free blocks that does not work with heap_3.
Get the default Metal GPU with MTLCreateSystemDefaultDevice in Objective-C on macOS 14 and read its name, unified memory flag and working-set budget.
Zero a register on AArch64 with mov x0, xzr, where register number 31 reads as zero in this encoding and as sp in others.
ldd lists the shared libraries a program will load, but on glibc it can run the program, so use readelf -d for binaries you do not trust.
Create and wake a kernel thread in one call with kthread_run(), check the ERR_PTR return, and give it a name that shows up in ps on Linux 6.x.
Declare a signed packed decimal with PIC S9(7)V99 COMP-3, which takes five bytes, and see how a value is stored.
Set MODER bits 11:10 to 01 and leave OTYPER at 0 to make PA5 a push-pull output on an STM32F4, using a read-modify-write that keeps other pins intact.
Read an open descriptor's access mode and status flags such as O_APPEND and O_NONBLOCK with fcntl F_GETFL on Linux 6.12, masking with O_ACCMODE.
We send one email when a new post is published. No spam.