Created
August 28, 2014 11:47
-
-
Save christianparpart/b4cef3daa4a464e5c624 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <functional> | |
#include <memory> | |
#include <stdio.h> | |
typedef std::function<void()> Task; | |
void onRead() { printf("onRead\n"); } | |
void onTimeout() { printf("onTimeout\n"); } | |
void wait(void* ep, Task&& onRead, Task&& onWrite, Task&& onTimeout) { | |
printf("wait@%p\n", ep); | |
if (onRead) onRead(); | |
if (onWrite) onWrite(); | |
if (onTimeout) onTimeout(); | |
} | |
int main() { | |
wait(nullptr, std::bind(onRead), nullptr, &onTimeout); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
trapni@stormsore [~/projects] > ./move
wait@(nil)
onRead
onTimeout