Skip to content

Instantly share code, notes, and snippets.

@dram
dram / rundylan.py
Last active October 21, 2015 13:30
#!/usr/bin/env python
import os
import sys
import subprocess
import tempfile
def dylan_compile(library, headers, sources, path=None):
prefix = os.path.basename(path) if path else library + "."
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>
static void debug(const char *msg) {
time_t t = time(NULL);
fprintf(stderr, "%s%s\n\n", ctime(&t), msg);
@dram
dram / thread-and-signal.c
Created May 31, 2013 08:40
Using signal and `pthread_kill` to terminate specific thread. `pthread_sigmask` can be used in thread to block signal temporarily.
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>
static void debug(const char *msg) {
time_t t = time(NULL);
fprintf(stderr, "%s%s\n\n", ctime(&t), msg);