Click here to Skip to main content
15,920,217 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: vista and MFC Pin
prasad_som24-Apr-07 18:48
prasad_som24-Apr-07 18:48 
GeneralRe: vista and MFC Pin
suraj Chhetry24-Apr-07 19:47
suraj Chhetry24-Apr-07 19:47 
AnswerRe: vista and MFC Pin
prasad_som24-Apr-07 21:12
prasad_som24-Apr-07 21:12 
GeneralRe: vista and MFC Pin
suraj Chhetry24-Apr-07 21:39
suraj Chhetry24-Apr-07 21:39 
AnswerRe: vista and MFC Pin
prasad_som24-Apr-07 22:23
prasad_som24-Apr-07 22:23 
Questionpriority queue with time limit Pin
charian092024-Apr-07 16:38
charian092024-Apr-07 16:38 
AnswerRe: priority queue with time limit Pin
Arman S.24-Apr-07 20:40
Arman S.24-Apr-07 20:40 
GeneralRe: priority queue with time limit Pin
charian092024-Apr-07 21:18
charian092024-Apr-07 21:18 
What i mean by age is the time that an item has lived in the queue.

i only have the following for now ...

1. template class for my queue:
template <class t=""> class ThreadSafePriorityQueue : public CComAutoCriticalSection
{
private:
priority_queue<t, vector<t=""> > m_q;
int m_intMaxSize;

public:
ThreadSafePriorityQueue()
{
m_intMaxSize = 10000;
}

ThreadSafePriorityQueue(int intMaxSize)
{
m_intMaxSize = intMaxSize;
}

~ThreadSafePriorityQueue()
{
}

bool push( const T& x )
{
bool rtn = true;
Lock();

if(m_q.size() > m_intMaxSize)
{
rtn = false;
}
else
{
m_q.push( x );
}

Unlock();

return rtn;
}

bool pop( T& x )
{
bool rtn = false;
Lock();
if( !m_q.empty() )
{
rtn = true;
x = m_q.top();
m_q.pop();
}
Unlock();
return rtn;
}

bool empty()
{
Lock();
bool rtn = m_q.empty();
Unlock();
return rtn;
}

T front()
{
Lock();
T rtn = m_q.top();
Unlock();
return rtn;
}
};


2. Then I have this structure that i pushed to the queue
typedef struct _StructPriorityRequest
{
int intPriority;
StructRequest structMessage;
bool operator < (const _StructPriorityRequest &structT2) const
{
return intPriority > structT2.intPriority;
}
} StructPriorityRequest;

How should i modify my codes so i could consider the age of the item in the queue? Please help me ....
GeneralRe: priority queue with time limit Pin
Arman S.25-Apr-07 20:20
Arman S.25-Apr-07 20:20 
GeneralRe: priority queue with time limit Pin
charian092026-Apr-07 17:22
charian092026-Apr-07 17:22 
GeneralRe: priority queue with time limit Pin
Arman S.26-Apr-07 19:45
Arman S.26-Apr-07 19:45 
QuestionFILE* fp and argv[] Pin
C_Zealot24-Apr-07 13:49
C_Zealot24-Apr-07 13:49 
AnswerRe: FILE* fp and argv[] Pin
Michael Dunn24-Apr-07 14:53
sitebuilderMichael Dunn24-Apr-07 14:53 
AnswerRe: FILE* fp and argv[] Pin
Sarath C24-Apr-07 15:18
Sarath C24-Apr-07 15:18 
QuestionDynamic memory allocation and Buffer length Pin
C_Zealot24-Apr-07 13:18
C_Zealot24-Apr-07 13:18 
QuestionRe: Dynamic memory allocation and Buffer length Pin
David Crow24-Apr-07 16:26
David Crow24-Apr-07 16:26 
AnswerRe: Dynamic memory allocation and Buffer length Pin
cmk25-Apr-07 13:25
cmk25-Apr-07 13:25 
QuestionDialog box error - check code [modified] Pin
Dustin Henry24-Apr-07 11:21
Dustin Henry24-Apr-07 11:21 
AnswerRe: Dialog box error - check code Pin
Mark Salsbery24-Apr-07 11:32
Mark Salsbery24-Apr-07 11:32 
GeneralRe: Dialog box error - check code Pin
Dustin Henry24-Apr-07 11:48
Dustin Henry24-Apr-07 11:48 
GeneralRe: Dialog box error - check code Pin
Mark Salsbery24-Apr-07 12:02
Mark Salsbery24-Apr-07 12:02 
GeneralRe: Dialog box error - check code Pin
Dustin Henry24-Apr-07 13:34
Dustin Henry24-Apr-07 13:34 
GeneralRe: Dialog box error - check code Pin
Mark Salsbery24-Apr-07 13:48
Mark Salsbery24-Apr-07 13:48 
QuestionRe: Dialog box error - check code Pin
David Crow24-Apr-07 16:28
David Crow24-Apr-07 16:28 
JokeRe: Dialog box error - check code Pin
Rajesh R Subramanian24-Apr-07 20:20
professionalRajesh R Subramanian24-Apr-07 20:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.