Skip to content

tbb:concurrent queue issue #83

Open
@GeorgeZaher

Description

// Struct representing a frame of video data
struct Frame1 {
std::string path;
int frameIndex;
int videoSerial;
int depth;
bool highPriority; // Priority flag
bool confidential; // Confidential information flag
std::chrono::time_pointstd::chrono::steady_clock startTime;

Frame(std::string p, int idx, int serial, int d, bool priority, bool confidentialData) 
    : path(std::move(p)), frameIndex(idx), videoSerial(serial), depth(d), highPriority(priority), confidential(confidentialData),
      startTime(std::chrono::steady_clock::now()) {}

};

struct MyCompare1 {
bool operator()(Frame1* _a, Frame1* _b) const {
if (_a->highPriority != _b->highPriority && _a->highPriority == true)
return true; // High-priority frames firs

    // Add more comparison logic if needed
    return false;
}

};

// High Priority Message Processing Test
TEST_F(SystemTest, HighPriorityMessageProcessingTest) {
tbb::concurrent_priority_queue<Frame1*, MyCompare1> frameQueue;

Frame1* regularFrame = new Frame1("regular_path", 0, 0, 5, false, false);
Frame1* highPriorityFrame = new Frame1("high_priority_path", 1, 0, 5, true, false);
frameQueue.push(regularFrame);
frameQueue.push(highPriorityFrame);

Frame1* firstOut;
frameQueue.pop(firstOut);

ASSERT_TRUE(firstOut->highPriority);  // Ensure high-priority message is processed first
delete firstOut;
delete regularFrame;
delete highPriorityFrame;

}

This test keep failing

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions