Sunday, February 27, 2011

ReadWriteLock in C++ for Windows using Mutex and Event

As well as Java has its ReentrantReadWriteLock, C# has its own ReaderWriterLock. What about a class that implements the concurrency control for read and write operations in C++ for Windows.

Friday, February 25, 2011

STL Allocator with low-fragmentation heap

The STL provides a series of data structure, like std::list or std::vector, known as containers. These containers are capable to change their sizes during application run-time, for that it uses dynamic allocators, or simply allocators. The STL already provides a standard allocator for general use, however it's also possible to write your own allocator to be used with containers. The disadvantage of using the standard allocator is because they uses new/delete, the same as malloc/free, which has performance implications that could not be ignored.

Thursday, February 24, 2011

Memory management in Windows applications

Contrary to what a lot of people thinks, an application written in C/C++ does not necessarily have to be faster than one made in Java or C#, because these platforms, since they were already designed to be *slower*, usually already has built-in the best methods for most commons application tasks. Among these methods, one of the most important to highlight is the memory management through heap space.

Monday, February 7, 2011

Event-Based Library for Arduino

After I worked in my first Arduino programs, maybe because I worked for a good time with languages like Java and C#, I have found that is a job a little outdated. Tasks like to handle push of buttons or turn a LED on smoothly through PWM, although of being easy to understand, require a reasonable volume of code to become consistent, especially when is necessary that various components work simultaneously.

Event-Based Library - Biblioteca de eventos para Arduino

Depois de feito meus primeiros programas para o Arduino, talvez por ter trabalhado durante um tempo em linguagens como Java e C#, tenho achado a sua programação um pouco antiquada. Tarefas como gerenciar apertos de botões ou fazer um LED acender suavimente atrávés de PWM, apesar de serem simples de se compreender, requer um volume razoável de código para ficarem consistentes, ainda mais quando é necessário que vários componentes funcionem simultâneamente.