This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| enum Color { BLACK, RED }; | |
| template <typename T> | |
| class Node_ { | |
| public: | |
| Node_ () { }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import threading | |
| import time | |
| import random | |
| import atomic | |
| foo = 0 | |
| class Worker(threading.Thread): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "os" | |
| ) | |
| func main () { | |
| v := os.Args[1:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A test of the interface types and how they may be passed | |
| package main | |
| import "fmt" | |
| type A interface { | |
| Action() | |
| } | |
| type C interface { |