mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
get_global_event_queue()
This commit is contained in:
parent
cf0576549b
commit
5a1bca16fc
@ -47,9 +47,18 @@ EventQueue::
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EventQueue::
|
||||
queue_event(CPT_Event event) {
|
||||
#ifdef OLD_HAVE_IPC
|
||||
nassertv(!event.is_null());
|
||||
#ifdef OLD_HAVE_IPC
|
||||
mutex_lock lock(_lock);
|
||||
#endif
|
||||
#endif
|
||||
#if 0
|
||||
// This is just some paranoid debug code. I had a problem where
|
||||
// one of the events was going null while it was in the queue.
|
||||
size_t limit = _queue.size();
|
||||
while (limit--) {
|
||||
nassertv(!_queue[limit].is_null());
|
||||
}
|
||||
#endif
|
||||
if (_queue.full()) {
|
||||
event_cat.error()
|
||||
<< "Ignoring event " << *event << "; event queue full.\n";
|
||||
@ -109,6 +118,7 @@ dequeue_event() {
|
||||
// thread extracting events. The magic of circular buffers.
|
||||
CPT_Event result = _queue.front();
|
||||
_queue.pop_front();
|
||||
nassertr(!result.is_null(), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "event.h"
|
||||
#include "pt_Event.h"
|
||||
|
||||
#include <circBuffer.h>
|
||||
#include "circBuffer.h"
|
||||
|
||||
#ifdef OLD_HAVE_IPC
|
||||
#include <ipc_mutex.h>
|
||||
@ -52,8 +52,7 @@ PUBLISHED:
|
||||
bool is_queue_full() const;
|
||||
CPT_Event dequeue_event();
|
||||
|
||||
INLINE static EventQueue *
|
||||
get_global_event_queue();
|
||||
INLINE static EventQueue *get_global_event_queue();
|
||||
|
||||
protected:
|
||||
CircBuffer<CPT_Event, max_events> _queue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user