<commit_before>//
//  testQueue.c
//  workdipatcher
//
//  Created by <NAME> on 11/12/13.
//  Copyright (c) 2013 <NAME> <<EMAIL>>. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "operationQueue.h"
#include <memory_management/memory_management.h>

#define ITER 10

void opf(WDOperation *operation, void *arg);

int main () {
	char *string = "Hello world";
	WDOperationQueue *operationQueue = WDOperationQueueAllocate();
	WDOperationQueueSetName(operationQueue, "queue.name");
	
	//for (unsigned int i=0; i<ITER; i++) {
		WDOperation *operation = WDOperationAllocate(opf, string);
		WDOperationQueueAddOperation(operationQueue, operation);
		release(operation);
	//}
	
	
	WDOperationQueueWaitAllOperations(operationQueue);
	release(operationQueue);
	return 0;
}

void opf(WDOperation *operation, void *arg) {
	static int i=0;
	char *string = arg;
	sleep(1);
	puts(string);
	WDOperationQueue *queue = WDOperationCurrentOperationQueue(operation);
	puts(WDOperationQueueGetName(queue));
	if (i++<ITER) {
		WDOperation *operation = WDOperationAllocate(opf, string);
		WDOperationQueueAddOperation(queue, operation);
		release(operation);
	}
	return;
}

<commit_msg>Test queue suspension and resumption<commit_after>//
//  testQueue.c
//  workdipatcher
//
//  Created by <NAME> on 11/12/13.
//  Copyright (c) 2013 <NAME> <<EMAIL>>. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "operationQueue.h"
#include <memory_management/memory_management.h>

#define ITER 10

void opf(WDOperation *operation, void *arg);

int main () {
	char *string = "Hello world";
	WDOperationQueue *operationQueue = WDOperationQueueAllocate();
	WDOperationQueueSetName(operationQueue, "queue.name");
	
	for (unsigned int i=0; i<ITER; i++) {
		WDOperation *operation = WDOperationCreate(opf, string);
		WDOperationQueueAddOperation(operationQueue, operation);
		release(operation);
	}
	
	
	WDOperationQueueWaitAllOperations(operationQueue);
	
	WDOperationQueueSuspend(operationQueue, 1);
	WDOperation *fistoperation = NULL;
	char *string2 = "hohohohho";
	for (unsigned int i=0; i<ITER; i++) {
		WDOperation *operation = WDOperationCreate(opf, string2);
		WDOperationQueueAddOperation(operationQueue, operation);
		if (i==0) fistoperation = operation;
		release(operation);
	}
	
	WDOperationQueueSuspend(operationQueue, 0);
	WDOperationWaitUntilFinished(fistoperation);
	release(operationQueue);
//	memory_management_print_stats();
	return 0;
}

void opf(WDOperation *operation, void *arg) {
	static int i=0;
	char *string = arg;
	usleep(50000);
	puts(string);
	WDOperationQueue *queue = WDOperationCurrentOperationQueue(operation);
	puts(WDOperationQueueGetName(queue));
	if (i++<ITER) {
		WDOperation *operation = WDOperationCreate(opf, string);
		WDOperationQueueAddOperation(queue, operation);
		release(operation);
	}
	return;
}


{'fraction_non_alphanumeric': 0.13096060815480304, 'fraction_numerical': 0.014512785072563926, 'mean_word_length': 5.732558139534884, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2047841', 'n_tokens_mistral': 1008, 'n_tokens_neox': 937, 'n_words': 211}