This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// OxAsio | |
// | |
// Created by sukinull on 1/8/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
// based on code, here - http://thisthread.blogspot.tw/2011/04/multithreading-with-asio.html | |
// you need C++11, and C++11 enabled boost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/bind.hpp> | |
#include "EventBus.h" | |
std::hash<std::string> Event::key; | |
void EventBus::Init() | |
{ | |
is_io_running = true; | |
m_work.reset(new boost::asio::io_service::work(io_service)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Require libuv v0.11 | |
// | |
// Created by sukinull on 1/8/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
// Created by sukinull on 1/8/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
// READ: http://nikhilm.github.io/uvbook/basics.html | |
#include <stdio.h> | |
#include <uv.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Require libuv v0.10 | |
// uv_fs_event_init() parameters changed after v0.11 | |
// | |
// Created by sukinull on 1/8/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <uv.h> | |
#define FIB_UNTIL 25 | |
uv_loop_t *loop; | |
long fib_(long t) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by sukinull on 2/14/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
// Simplest libwebsocks example | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <getopt.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by sukinull on 2/14/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
// Simplest websocks example using nopoll - http://www.aspl.es/nopoll/ | |
// remark nopoll_conn_set_sock_block (session, nopoll_false); in nopoll_conn_sock_connect under OS X | |
// use nopoll_conn_set_sock_block to set sock non-block after connect | |
// | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by sukinull on 2/14/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
// based on nopoll_pure.c - https://gist.github.com/sukinull/9327937#file-nopoll_pure-c | |
// add callback function for receive | |
// | |
#include <stdio.h> | |
#include <nopoll.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by sukinull on 2/14/14. | |
// Copyright (c) 2014 sukinull. All rights reserved. | |
// | |
// With libuv | |
// | |
// based on nopoll_w_cb.c - https://gist.github.com/sukinull/9328010#file-nopoll_w_cb-c | |
// and integrated with libuv | |
// |
OlderNewer