Queue impl

Implements Queue.

Summary
Queue implImplements Queue.
CopyrightThis program is free software.
Files
C-kern/api/ds/inmem/queue.hHeader file Queue.
C-kern/ds/inmem/queue.cImplementation file Queue impl.
queue_page_t
static variables
helper
lifetime
new_queuepageAllocates single memory page with ALLOC_PAGECACHE with size <pagesize_4096>.
delete_queuepageFrees single memory page with RELEASE_PAGECACHE.
query
end_queuepageReturns address after the last element on page.
end_queuepageReturns address after the last element on page.
update
queue_t
helper
lifetime
update
test

Copyright

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 for more details.

Author

© 2013 Jörg Seebohn

Files

C-kern/api/ds/inmem/queue.h

Header file Queue.

C-kern/ds/inmem/queue.c

Implementation file Queue impl.

queue_page_t

Summary
static variables
helper
lifetime
new_queuepageAllocates single memory page with ALLOC_PAGECACHE with size <pagesize_4096>.
delete_queuepageFrees single memory page with RELEASE_PAGECACHE.
query
end_queuepageReturns address after the last element on page.
end_queuepageReturns address after the last element on page.
update

static variables

helper

lifetime

new_queuepage

static int new_queuepage(/*out*/queue_page_t **qpage,
queue_t *queue)

Allocates single memory page with ALLOC_PAGECACHE with size <pagesize_4096>.

delete_queuepage

static int delete_queuepage(queue_page_t **qpage)

Frees single memory page with RELEASE_PAGECACHE.

query

end_queuepage

static void * end_queuepage(queue_page_t *qpage)

Returns address after the last element on page.

end_queuepage

Returns address after the last element on page.

update

helper

lifetime

update

test

Offers data structure to store fixed size elements in LIFO or FIFO order.
Implements Queue.
static int new_queuepage(/*out*/queue_page_t **qpage,
queue_t *queue)
Allocates single memory page with ALLOC_PAGECACHE with size pagesize_4096.
#define ALLOC_PAGECACHE(
   pgsize,
   page
) (allocpage_pagecache(pagecache_maincontext(), (pgsize), (page)))
Allocates a single memory page of size pgsize (see pagesize_e) and returns it in page.
static int delete_queuepage(queue_page_t **qpage)
Frees single memory page with RELEASE_PAGECACHE.
#define RELEASE_PAGECACHE(
   page
) (releasepage_pagecache(pagecache_maincontext(), (page)))
Releases previously allocated memory page.
static void * end_queuepage(queue_page_t *qpage)
Returns address after the last element on page.
Close