Skip to content

Instantly share code, notes, and snippets.

@patrickseda
patrickseda / SampleImpl.java
Created September 7, 2011 15:37
Java ShutdownHook registration class for managing controlled shut downs.
/**
* Sample implementation of a Shutdownable object.
*/
public class SampleImpl implements Shutdownable {
public static void main(String[] args) {
SampleImpl sample = new SampleImpl();
// Make the JVM call our shutdown() method upon exit.
ShutdownHook.registerForShutdownHook(sample);
@vaclavbohac
vaclavbohac / queue-delete.c
Created April 11, 2011 23:51
Delete existing message queue in C.
// Deletes message queue in C.
// For educational purposes only.
// Author: Vaclav Bohac
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <signal.h>