Implemented the log on and log off systems

This is a pretty straight forward port of the old version, including the
incredibly hacky server list. But I just need to remember that this is a
prototype.
This commit is contained in:
Kayne Ruse
2013-11-23 17:53:36 +11:00
parent ca86dc5fb8
commit 6ccc874583
11 changed files with 220 additions and 68 deletions
+1 -42
View File
@@ -42,45 +42,4 @@ int main(int argc, char** argv) {
}
cout << "Clean exit" << endl;
return 0;
}
/*/
#include "thread_safe_queue.hpp"
#include "SDL/SDL.h"
#include <iostream>
using namespace std;
struct Object {
int value = 0;
};
int func(void* arg) {
ThreadSafeQueue<Object>& queue = *reinterpret_cast<ThreadSafeQueue<Object>*>(arg);
while(1) {
Object o = queue.PopFront();
if (o.value != 0) {
cout << o.value;
SDL_Delay(500);
cout << endl;
}
}
}
int main(int, char**) {
ThreadSafeQueue<Object> queue;
SDL_Thread* thread1 = SDL_CreateThread(func, reinterpret_cast<void*>(&queue));
SDL_Thread* thread2 = SDL_CreateThread(func, reinterpret_cast<void*>(&queue));
SDL_Thread* thread3 = SDL_CreateThread(func, reinterpret_cast<void*>(&queue));
while(1) {
SDL_Delay(1000);
Object o;
o.value = 3;
queue.PushBack(o);
}
return 0;
}
//*/
}