Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tbb:concurrent queue issue #83

Open
GeorgeZaher opened this issue Sep 18, 2024 · 0 comments
Open

tbb:concurrent queue issue #83

GeorgeZaher opened this issue Sep 18, 2024 · 0 comments

Comments

@GeorgeZaher
Copy link

// 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant