X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/f1d4d7298ecd05bbeaf4fce2001a183b20435067..f63895da2dd9edf0d6f475d49ba9e845c1083f18:/queue.h diff --git a/queue.h b/queue.h new file mode 100755 index 0000000..ff43e78 --- /dev/null +++ b/queue.h @@ -0,0 +1,49 @@ +/* + * + * Copyright (C) 2003 and beyond by Alexander Strange + * and the Dawn Of Infinity developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This license is contained in the file "COPYING", + * which is included with this source code; it is available online at + * http://www.gnu.org/licenses/gpl.html + * + */ + +/* + * $Id$ + * + */ +#pragma once only +#ifndef _QUEUE_H +#define _QUEUE_H +#include +#include + +typedef struct queue { + void **data; + size_t begin; + size_t end; + size_t allocated; + size_t filled; + pthread_rwlock_t pmutex; +} queue; + +typedef void (*qperformer) (void *context, void *p); + +extern queue *qinit(queue *q,size_t defaultsize); +extern void qdel(queue *q); +extern void *qpop(queue *q); +extern void qpush(queue *q, void *p); +extern size_t growarray(void ***datap, size_t oldsize); +extern void qperform(queue *q, qperformer p, void *pctx); +#endif \ No newline at end of file