|
|
1.1 ! root 1: /* msg_queue.h */ ! 2: ! 3: /* Uni or Bi-directional FIFO message queue */ ! 4: ! 5: /* $Id: msg_queue.h,v 1.5 2005/05/09 09:01:28 rswindell Exp $ */ ! 6: ! 7: /**************************************************************************** ! 8: * @format.tab-size 4 (Plain Text/Source Code File Header) * ! 9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * ! 10: * * ! 11: * Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html * ! 12: * * ! 13: * This library is free software; you can redistribute it and/or * ! 14: * modify it under the terms of the GNU Lesser General Public License * ! 15: * as published by the Free Software Foundation; either version 2 * ! 16: * of the License, or (at your option) any later version. * ! 17: * See the GNU Lesser General Public License for more details: lgpl.txt or * ! 18: * http://www.fsf.org/copyleft/lesser.html * ! 19: * * ! 20: * Anonymous FTP access to the most recent released source is available at * ! 21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * ! 22: * * ! 23: * Anonymous CVS access to the development source and modification history * ! 24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: * ! 25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login * ! 26: * (just hit return, no password is necessary) * ! 27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src * ! 28: * * ! 29: * For Synchronet coding style and modification guidelines, see * ! 30: * http://www.synchro.net/source.html * ! 31: * * ! 32: * You are encouraged to submit any modifications (preferably in Unix diff * ! 33: * format) via e-mail to [email protected] * ! 34: * * ! 35: * Note: If this box doesn't appear square, then you need to fix your tabs. * ! 36: ****************************************************************************/ ! 37: ! 38: #ifndef _MSG_QUEUE_H ! 39: #define _MSG_QUEUE_H ! 40: ! 41: #include "link_list.h" ! 42: ! 43: #if defined(__cplusplus) ! 44: extern "C" { ! 45: #endif ! 46: ! 47: typedef struct { ! 48: char name[128]; /* for named-queues */ ! 49: link_list_t in; ! 50: link_list_t out; ! 51: pthread_t owner_thread_id; /* reads from in, writes to out */ ! 52: long refs; ! 53: unsigned long flags; /* private use flags */ ! 54: void* private_data; ! 55: } msg_queue_t; ! 56: ! 57: #define MSG_QUEUE_MALLOC (1<<0) /* Queue allocated with malloc() */ ! 58: #define MSG_QUEUE_BIDIR (1<<1) /* Bi-directional message queue */ ! 59: ! 60: msg_queue_t* msgQueueInit(msg_queue_t*, long flags); ! 61: BOOL msgQueueFree(msg_queue_t*); ! 62: ! 63: long msgQueueAttach(msg_queue_t*); ! 64: long msgQueueDetach(msg_queue_t*); ! 65: ! 66: /* Get/Set queue private data */ ! 67: void* msgQueueSetPrivateData(msg_queue_t*, void*); ! 68: void* msgQueueGetPrivateData(msg_queue_t*); ! 69: ! 70: BOOL msgQueueWait(msg_queue_t* q, long timeout); ! 71: long msgQueueReadLevel(msg_queue_t*); ! 72: void* msgQueueRead(msg_queue_t*, long timeout); ! 73: void* msgQueuePeek(msg_queue_t*, long timeout); ! 74: void* msgQueueFind(msg_queue_t*, const void*, size_t length); ! 75: list_node_t* msgQueueFirstNode(msg_queue_t*); ! 76: list_node_t* msgQueueLastNode(msg_queue_t*); ! 77: #define msgQueueNextNode(node) listNextNode(node) ! 78: #define msgQueuePrevNode(node) listPrevNode(node) ! 79: #define msgQueueNodeData(node) listNodeData(node) ! 80: ! 81: long msgQueueWriteLevel(msg_queue_t*); ! 82: BOOL msgQueueWrite(msg_queue_t*, const void*, size_t length); ! 83: ! 84: #if defined(__cplusplus) ! 85: } ! 86: #endif ! 87: ! 88: #endif /* Don't add anything after this line */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.