Yesterday I wrote a blog post talking about Event Loops, this was a pre-cursor to discussing where I am using them in an application I’m currently developing which uses NCurses at its core.
Unfortunately the application is an R&D project and is not public yet (still very early in development), but it is written in C, has a TUI front end and handles many windows and network connections simultaneously so I am using libuv heavily underneath. For this post I’ll be discussing the integration between libuv and NCurses.
Continue reading Event Loops and NCurses
The concept of event loops is not new in programming, but I think it is still a really important technique to learn. They allow a program to send a request for something and carry on doing things rather than waiting on things to happen. It is a great way of multi-tasking in a single thread but there are some gotchas to be aware of.
In this blog post I’ll give a short intro to event loops and how to get the most out of them.
Continue reading Event Loop Programming: A Different Way of Thinking
Way back when I was at NGINX I worked with several people on integrating a kernel patch for SO_REUSEPORT in Linux to work with NGINX for something I termed “socket sharding“. In hindsight I should have maybe called it “socket load balancing” but the term “sharding” has stuck with that option across the industry now. Whilst this option is a standard option in many *nix kernels it behaves very differently in them. So I thought I would note some details down in this blog post
Continue reading Socket SO_REUSEPORT and Kernel Implementations
Valgrind is an incredibly powerful tool which helps find leaks, buffer overflows and many other things. Whilst being extremely powerful it can also be very slow. As an alternative there are little known tools that are available for Clang and GCC which can fulfil similar functions for your C / C++ applications but with much higher performance.
I’ve had several people ask me about the sanitizers recently and how to use them, so I’ll cover some basics here.
Continue reading Sanitizers, The Alternative To Valgrind
The key to learning anything new is finding a way to engage with the material. Some people learn by reading and some learn by doing. I typically fall into the latter half and I’ve typically been more successful in mentoring people who learn in a more hands-on way.
A recent Tweet I made led to a chat which somehow led to a famous Open Source developer getting me kickstarted into the world of developing in the Go Programming Language. This post tracks some of my journey for the last week (my first week of learning Go).
Continue reading My Journey Learning The Go Programming Language
Whilst porting code between Linux and macOS I have come across two issues which make assumptions about how something works but in reality different implementations of libc handle them differently. In this post I’ll talk about recent issues I faced with
Continue reading POSIX File Handling and Undefined Behaviour
fclose() in codebases.
You may be familiar with variadic functions in C, these are basically functions that allow a variable number of parameters, they are normally written like this:
void my_print_func(const char *format, ...)
Obviously you can do more with them and they are very useful, but if you want to have one function calling another things can get complicated. This post explores the problem and a couple of ways of solving it.
Continue reading Nested Variadic Functions in C