MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / EGLXDisplayHash

Class EGLXDisplayHash

server/EGLXDisplayHash.h:31–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace faker
30{
31 class EGLXDisplayHash : public HASH
32 {
33 public:
34
35 static EGLXDisplayHash *getInstance(void)
36 {
37 if(instance == NULL)
38 {
39 util::CriticalSection::SafeLock l(instanceMutex);
40 if(instance == NULL) instance = new EGLXDisplayHash;
41 }
42 return instance;
43 }
44
45 static bool isAlloc(void) { return instance != NULL; }
46
47 void add(Display *dpy, int screen, EGLXDisplay *eglxdpy)
48 {
49 if(!dpy || !eglxdpy) THROW("Invalid argument");
50 HASH::add(dpy, screen, eglxdpy);
51 }
52
53 EGLXDisplay *find(Display *dpy, int screen)
54 {
55 if(!dpy) return NULL;
56 return HASH::find(dpy, screen);
57 }
58
59 bool find(EGLDisplay edpy)
60 {
61 if(!edpy) return false;
62
63 HashEntry *entry = NULL;
64 util::CriticalSection::SafeLock l(mutex);
65
66 entry = start;
67 while(entry != NULL)
68 {
69 if((EGLDisplay)entry->value == edpy)
70 return true;
71 entry = entry->next;
72 }
73 return false;
74 }
75
76 void remove(Display *dpy, int screen)
77 {
78 if(!dpy) return;
79 HASH::remove(dpy, screen);
80 }
81
82 private:
83
84 ~EGLXDisplayHash(void)
85 {
86 EGLXDisplayHash::kill();
87 }
88

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected