Skip to content

Instantly share code, notes, and snippets.

View dcolish's full-sized avatar

Dan dcolish

View GitHub Profile
#include <iostream>
using namespace std;
enum Color { BLACK, RED };
template <typename T>
class Node_ {
public:
Node_ () { };
#include <pthread.h>
#include <stdio.h>
#include "Python.h"
#define atomic_int_add(ptr, val) __sync_add_and_fetch(&ptr, val)
static PyObject*
int_add(PyObject *self, PyObject *args)
{
import threading
import time
import random
import atomic
foo = 0
class Worker(threading.Thread):
#include <pthread.h>
#include <stdio.h>
#include "Python.h"
#define atomic_int_add(ptr, val) __sync_add_and_fetch(&ptr, val)
static PyObject*
int_add(PyObject *self, PyObject *args)
{
#include <pthread.h>
#include <stdio.h>
#define atomic_int_add(ptr, val) __sync_add_and_fetch(&ptr, val)
int counter = 0;
void* worker(void* val){
int i;
#ifdef ATOMIC
#include <pthread.h>
#include <stdio.h>
#define atomic_int_add(ptr, val) __sync_add_and_fetch(&ptr, val)
int counter = 0;
void* worker(void* val){
int i;
#ifdef ATOMIC
#include <Python.h>
#include "structmember.h"
#define atomic_int_add(ptr, val) __sync_add_and_fetch(ptr, val)
typedef struct {
PyObject_HEAD
int number;
} AtomicInt;
#include <Python.h>
#include "structmember.h"
#define atomic_int_add(ptr, val) __sync_add_and_fetch(ptr, val)
typedef struct {
PyObject_HEAD
int number;
} AtomicInt;
@dcolish
dcolish / cat.go
Created April 30, 2012 05:09
something like cat but done in go
package main
import (
"fmt"
"io"
"os"
)
func main () {
v := os.Args[1:]
@dcolish
dcolish / sometypes.go
Created April 30, 2012 15:20
Interfaces are fun
// A test of the interface types and how they may be passed
package main
import "fmt"
type A interface {
Action()
}
type C interface {