Rate This Document
Findability
Accuracy
Completeness
Readability

kupl_queue_create_with_priority

Create a KUPL priority queue.

Interface Definition

kupl_queue_h kupl_queue_create_with_priority(int priority);

Environment Variables

KUPL uses the environment variable KUPL_ENABLE_PRIORITY to control whether to enable the priority feature.

Setting KUPL_ENABLE_PRIORITY to 1 enables the priority feature. Setting KUPL_ENABLE_PRIORITY to 0 disables the priority feature.

Parameters

Parameter

Type

Description

Input/Output

priority

int

Queue priority value.

Input

Return Value

Success: created queue

Failure: nullptr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <stdio.h> 
#include "kupl.h" 

int main() 
{ 
    int least_priority;
    int greatest_priority;
    kupl_get_queue_priority_range(&least_priority, &greatest_priority); 
    int priority = least_priority;
    kupl_queue_h queue = kupl_queue_create_with_priority(priority); 
    kupl_queue_destroy(queue); 
    return 0; 
}

The preceding example demonstrates how to create and destroy a priority queue. The kupl_queue_create_with_priority function creates a reusable priority queue.