Skip to content

A small thread-safe queue written in C

License

Notifications You must be signed in to change notification settings

tobithiel/Queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 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 (windows support relies on LGPL licensed pthreads-win32 (http://sourceware.org/pthreads-win32/))

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

Build steps:
- mkdir build && cd build
- cmake ..
- make / build VS project under windows

Building 32-/64-bit:
- OS X: universal binaries are built
- Linux: use 'cmake -DBUILT_32=ON ..' to force 32-bit built, -DBUILT_64=ON for 64-bit
- Windows: use 'cmake -G "Visual Studio 11 Win64" -DBUILT_64=ON ..' to force a 64-bit build, 'cmake -G "Visual Studio 11" -DBUILT_32=ON ..' for 32-bit

TODO:
- proper test suite, so that everybody can easily see whats tested and run the tests himself
- ability to turn of element counting => only unlimited queue
- function to 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

Languages