Skip to content

MatthewEdge/Queue

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queue
- thread-safe
- ability to define max number of elements
- sort elements into queue
- get in O(1), except when filtered (worst case O(n))
- put in O(1) when unsorted, in O(n) in the worst case when sorted
- MIT license

sorted queue:
  your elements in the queue will be ordered according to the sort function which is given.

compilation OS X:
  dylib:   gcc -dynamiclib -Wall -Wextra -Wno-unused-parameter -lpthread -o libqueue.dylib queue.c queue_internal.c
  example: gcc -Wall -Wextra -Wno-unused-parameter -lpthread -o example queue.c queue_internal.c example.c
compilation Linux:
  example: gcc -Wall -Wextra -Wno-unused-parameter -lpthread -o example queue.c queue_internal.c example.c

TODO:
- proper test suite, so that everybody can easily see whats tested and run the tests himself
- Windows support
- dynamically create type-safe put/get methods with macros
- ability to turn of element counting => only unlimited queue
- peek at next element

error codes:
 < 0 => error
 = 0 => okay

 0 - everything alright

-1 - invalid queue
-2 - could not acquire lock
-3 - could not allocate memory
-4 - no new data allowed
-5 - invalid element in queue
-6 - invalid callback
-7 - max_elements reached or no elements in queue

About

A small thread-safe queue written in C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published