This file is indexed.

/usr/include/barry18/barry/dataqueue.h is in libbarry-dev 0.18.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
///
/// \file	dataqueue.h
///		FIFO queue of Data objects
///

/*
    Copyright (C) 2007-2013, Net Direct Inc. (http://www.netdirect.ca/)

    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 in the COPYING file at the
    root directory of this project for more details.
*/

#ifndef __BARRY_DATAQUEUE_H__
#define __BARRY_DATAQUEUE_H__

#include "dll.h"
#include <list>
#include <pthread.h>
#include <iosfwd>

namespace Barry {

class Data;

//
// DataQueue class
//
/// This class provides a thread aware fifo queue for Data objects,
/// providing memory management for all Data object pointers it contains.
///
/// It uses similar member names as std::queue<>, for consistency.
///
class BXEXPORT DataQueue
{
	// always use the raw_push() and raw_pop() functions
	typedef std::list<Data*>			queue_type;

	pthread_mutex_t m_waitMutex;
	pthread_cond_t m_waitCond;

	mutable pthread_mutex_t m_accessMutex;	// locked for each access of m_queue

	queue_type m_queue;

protected:
	void raw_push(Data *data);
	Data* raw_pop();

public:
	DataQueue();
	~DataQueue();		// frees all data in the queue

	// Pushes data into the end of the queue.
	// The queue owns this pointer as soon as the function is
	// called.  In the case of an exception, it will be freed.
	// Performs a thread broadcast once new data has been added.
	void push(Data *data);

	// Pops the next element off the front of the queue.
	// Returns 0 if empty.
	// The queue no longer owns this pointer upon return.
	Data* pop();

	// Pops the next element off the front of the queue, and
	// waits until one exists if empty.  If still no data
	// on timeout, returns null.
	// Timeout specified in milliseconds.  Default is wait forever.
	Data* wait_pop(int timeout = -1);

	// Pops all data from other and appends it to this.
	// After calling this function, other will be empty, and
	// this will contain all its data.
	// In the case of an exception, any uncopied data will
	// remain in other.
	void append_from(DataQueue &other);

	bool empty() const;	// return true if empty
	size_t size() const;

	void DumpAll(std::ostream &os) const;
};

inline std::ostream& operator<< (std::ostream &os, const DataQueue &dq)
{
	dq.DumpAll(os);
	return os;
}

} // namespace Barry

#endif