summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/request_queue.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-03-17 20:33:47 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-03-17 20:33:47 +0000
commitdd3d0e59dcd34beb222fcf612a51d3fee82c0e43 (patch)
tree0ae5a6e0a83399036d1452256ee3f89dc6da8872 /protocols/SkypeWeb/src/request_queue.h
parent076fa9b3142f55fc736fbf58b20bfa45973acd68 (diff)
SkypeWeb: initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@12424 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/request_queue.h')
-rw-r--r--protocols/SkypeWeb/src/request_queue.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/request_queue.h b/protocols/SkypeWeb/src/request_queue.h
new file mode 100644
index 0000000000..df9154882c
--- /dev/null
+++ b/protocols/SkypeWeb/src/request_queue.h
@@ -0,0 +1,50 @@
+#ifndef _SKYPE_REQUEST_QUEUE_H_
+#define _SKYPE_REQUEST_QUEUE_H_
+
+typedef void (*HttpResponseCallback)(const NETLIBHTTPREQUEST *response, void *arg);
+
+struct RequestQueueItem
+{
+ void *arg;
+ HttpRequest *request;
+ HttpResponseCallback responseCallback;
+
+ RequestQueueItem(HttpRequest *request, void *arg) :
+ request(request), responseCallback(NULL), arg(arg) { }
+
+ RequestQueueItem(HttpRequest *request, HttpResponseCallback response, void *arg) :
+ request(request), responseCallback(response), arg(arg) { }
+
+ ~RequestQueueItem()
+ {
+ delete request;
+ request = NULL;
+ responseCallback = NULL;
+ }
+};
+
+class RequestQueue
+{
+private:
+ bool isTerminated;
+ HANDLE hConnection;
+ mir_cs requestQueueLock;
+ LIST<RequestQueueItem> requests;
+ HANDLE hRequestQueueEvent, hRequestQueueThread;
+
+ void Execute(RequestQueueItem *item);
+
+ static unsigned int __cdecl WorkerThread(void*, void*);
+
+public:
+ RequestQueue(HANDLE hConnection);
+ ~RequestQueue();
+
+ void Start();
+ void Stop();
+
+ void Push(HttpRequest *request, HttpResponseCallback response = NULL, void *arg = NULL);
+
+};
+
+#endif //_SKYPE_REQUEST_QUEUE_H_ \ No newline at end of file