<commit_before>/**

\class QxtRingBuffer QxtRingBuffer

\ingroup media

\brief thread safe ring buffer
 
 * The key attribute of a ringbuffer is that it can be safely accessed
 * by two threads simultaneously -- one reading from the buffer and
 * the other writing to it -- without using any synchronization or
 * mutual exclusion primitives.  For this to work correctly, there can
 * only be a single reader and a single writer thread.  Their
 * identities cannot be interchanged.
*/


#include "QxtRingBuffer.h"
#include "ringbuffer.h"

class QxtRingBufferPrivate : public QxtPrivate<QxtRingBuffer>
	{
	QXT_DECLARE_PUBLIC(QxtRingBuffer);	
	public:
		void construct(unsigned long size)
			{
			ring= jack_ringbuffer_create(size);
			}
	
		 void destruct()
			{
			jack_ringbuffer_free(ring);
			}

		unsigned long read(char * destination, unsigned long size)
			{
			return jack_ringbuffer_read(ring , destination,size);
			}
		
		unsigned long available()
			{
			return jack_ringbuffer_read_space(ring);
			}

		unsigned long write(char * source, unsigned long size)
			{
			return jack_ringbuffer_write(ring, source,size);
			}

		unsigned long peek(char * destination, unsigned long size)
			{
			return jack_ringbuffer_peek (ring,destination, size);
			}
		void get_read_vector    (char  **buffer,unsigned long * length)
			{
			jack_ringbuffer_data_t  vec;
			jack_ringbuffer_get_read_vector(ring,&vec);
			*buffer=vec.buf;
			*length=vec.len;
			}
		void get_write_vector   (char  **buffer,unsigned long * length)
			{
			jack_ringbuffer_data_t  vec;
			jack_ringbuffer_get_write_vector(ring,&vec);
			*buffer=vec.buf;
			*length=vec.len;
			}
		void read_advance       (unsigned long length)
			{
			jack_ringbuffer_read_advance(ring, length);
			}
		void write_advance       (unsigned long length)
			{
			jack_ringbuffer_write_advance(ring, length);
			}

	private:
		jack_ringbuffer_t *  ring;
	};

<commit_msg>corected a stupid bug that smashed teh stack<commit_after>/**

\class QxtRingBuffer QxtRingBuffer

\ingroup media

\brief thread safe ring buffer
 
 * The key attribute of a ringbuffer is that it can be safely accessed
 * by two threads simultaneously -- one reading from the buffer and
 * the other writing to it -- without using any synchronization or
 * mutual exclusion primitives.  For this to work correctly, there can
 * only be a single reader and a single writer thread.  Their
 * identities cannot be interchanged.
*/


#include "QxtRingBuffer.h"
#include "ringbuffer.h"

class QxtRingBufferPrivate : public QxtPrivate<QxtRingBuffer>
	{
	QXT_DECLARE_PUBLIC(QxtRingBuffer);	
	public:
		void construct(unsigned long size)
			{
			ring= jack_ringbuffer_create(size);
			}
	
		 void destruct()
			{
			jack_ringbuffer_free(ring);
			}

		unsigned long read(char * destination, unsigned long size)
			{
			return jack_ringbuffer_read(ring , destination,size);
			}
		
		unsigned long available()
			{
			return jack_ringbuffer_read_space(ring);
			}

		unsigned long write(char * source, unsigned long size)
			{
			return jack_ringbuffer_write(ring, source,size);
			}

		unsigned long peek(char * destination, unsigned long size)
			{
			return jack_ringbuffer_peek (ring,destination, size);
			}
		void get_read_vector    (char  **buffer,unsigned long * length)
			{
			jack_ringbuffer_data_t  vec[2];
			jack_ringbuffer_get_read_vector(ring,vec);
			*buffer=vec[0].buf;
			*length=vec[0].len;
			}
		void get_write_vector   (char  **buffer,unsigned long * length)
			{
			jack_ringbuffer_data_t  vec[2];
			jack_ringbuffer_get_write_vector(ring,vec);
			*buffer=vec[0].buf;
			*length=vec[0].len;
			}
		void read_advance       (unsigned long length)
			{
			jack_ringbuffer_read_advance(ring, length);
			}
		void write_advance       (unsigned long length)
			{
			jack_ringbuffer_write_advance(ring, length);
			}

	private:
		jack_ringbuffer_t *  ring;
	};


{'fraction_non_alphanumeric': 0.08528127408168508, 'fraction_numerical': 0.0015412278448497304, 'mean_word_length': 3.76039119804401, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1976969', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1230, 'n_words': 335}