Skip to content

Instantly share code, notes, and snippets.

@Murf
Created December 3, 2012 03:06
Show Gist options
  • Save Murf/4192359 to your computer and use it in GitHub Desktop.
Save Murf/4192359 to your computer and use it in GitHub Desktop.
segfault on libaprustil
/*
============================================================================
Name : x86.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <apr.h>
#include <apr_general.h>
#include <apr_thread_proc.h>
#include <apr_thread_pool.h>
#include <apr_queue.h>
static struct memory_manager {
apr_queue_t *input_queue;
apr_thread_pool_t *thread_pool;
apr_pool_t *memory_pool;
int running;
} memory_manager;
int main(void) {
//BM create a local message queue using apr_queue
apr_status_t rv = APR_SUCCESS;
apr_initialize();
memset(&memory_manager, 0, sizeof(memory_manager));
memory_manager.running = 1;
apr_pool_create(&memory_manager.memory_pool, NULL);
//BM segfaults here
rv = apr_thread_pool_destroy(memory_manager.thread_pool);
assert(rv == APR_SUCCESS);
apr_pool_destroy(memory_manager.memory_pool);
apr_terminate();
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment