Skip to content

0xfederama/synchronized-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

synchronized-queue

A thread synchonized FIFO queue made for C's PThreads.

Usage

Place the files fifoQ.c and fifoQ.h in your project directory.

In order to compile the code and run it, first off you have to compile the library:

gcc fifoQ.c -c -o fifoQ.o

Then create the static library:

ar rvs libfifoq.a fifoQ.o

And compile with your source code:

gcc main.c -lpthread -o main -L. -lfifoq


Here's what you can do with this library:

//Create the queue
queue Q = initQueue();
	
//Insert an element in the queue
void *element;
push(Q, element);

//Remove an element from the queue
void *head = pop(Q);

//Get the size of the queue
size_t size = getSize(Q);

//Delete and free the space of the queue
deleteQueue(Q);

License

Under the MIT License, you can do whatever you want with this library. Anyway, a mention would be appreciated 😉.

About

A thread synchonized queue made for PThreads

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages