• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

ink_llqueue.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #ifndef _INK_LLQUEUE_H
00025 #define _INK_LLQUEUE_H
00026 
00027 /****************************************************************************
00028 
00029 
00030 A simple linked list queue.
00031 ****************************************************************************/
00032 #include "ink_mutex.h"
00033 #include "ink_thread.h"
00034 
00035 typedef struct llqrec_s
00036 {
00037   struct llqrec_s *next;
00038   void *data;
00039 } LLQrec;
00040 
00041 typedef struct llq_s
00042 {
00043   LLQrec * head, *tail, *free;
00044   uint64_t len, highwater;
00045   ink_mutex mux;
00046   ink_semaphore sema;
00047 } LLQ;
00048 
00049 LLQ *create_queue(void);
00050 int enqueue(LLQ * q, void *data);
00051 void *dequeue(LLQ * q);
00052 int queue_is_empty(LLQ * q);
00053 uint64_t queue_len(LLQ * Q);
00054 uint64_t queue_highwater(LLQ * Q);
00055 void delete_queue(LLQ * Q);     /* only deletes an empty queue but
00056                                    provides symmetry. */
00057 
00058 
00059 #endif

Generated by  doxygen 1.7.1