Skip to content

Instantly share code, notes, and snippets.

@develhox
develhox / switchs.h
Last active September 30, 2024 15:23
Switch operand implementation for the strings
#ifndef __SWITCHS_H__
#define __SWITCHS_H__
#include <string.h>
#include <regex.h>
#include <stdbool.h>
/** Begin a switch for the string x */
#define switchs(x) \
{ char *ss__sw = (x); bool ss__done = false; bool ss__cont = false; \
@develhox
develhox / mutex.h
Created April 13, 2015 19:35
C99 Mutex implementation to avoid same-thread deadlock and define locked portions of code
#ifndef __MUTEX_H__
#define __MUTEX_H__
#include <pthread.h>
/**
* Mutex type
*/
typedef struct {
pthread_mutex_t mutex; // pthread mutex