Skip to content

Instantly share code, notes, and snippets.

View kindofblue's full-sized avatar

Pingkai Liu kindofblue

  • AT&T Labs Research
  • New York, NY
View GitHub Profile
@DanGe42
DanGe42 / context_demo.c
Created October 25, 2013 03:14
A non-trivial example of how to use user contexts for trivial scheduling.
#include <ucontext.h>
#include <sys/types.h>
#include <sys/time.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <poll.h>
/* ucontext sample program
## This is an example of executing code when your zenpack gets installed (or removed)
## This __init__.py file should be located at ZenPacks.namespace.Name/ZenPacks/namespace/Name/__init__.py
## This code should be carefully added to your zenpack so as not to accidently overwrite key methods (
'''
Here begins the non default code
'''
# Import all the things.