summaryrefslogtreecommitdiffstats
path: root/test/httpget.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-07-02 20:23:07 +0300
committerTimo Teräs <timo.teras@iki.fi>2010-07-02 20:25:47 +0300
commit23b95bf1a15322c2f471b80c06cb65d9b2d2a282 (patch)
tree9bf12231db9591852e3b42ca24715d2cbaf6267b /test/httpget.c
parent0183e33d9a4759764716e771b85e19f7a997b8bd (diff)
downloadlibtf-master.tar.bz2
libtf-master.tar.xz
libtf: major redesign startedHEADmaster
the idea is to make libtf completely multi-threaded. meaning each fiber can be running concurrently in separate thread. quite a bit of framework is added for this and some atomic helpers are already introduced. however, io polling is busy polling now (will be soon in own thread) and timeouts are still more or less broken. oh, and the multithreading core is not there yet. basically we are currently mostly broken ;)
Diffstat (limited to 'test/httpget.c')
-rw-r--r--test/httpget.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/httpget.c b/test/httpget.c
index 29f7f14..876b63c 100644
--- a/test/httpget.c
+++ b/test/httpget.c
@@ -14,6 +14,7 @@ static void ping_fiber(void *ptr)
struct ctx *ctx = (struct ctx*) ptr;
struct tf_sockaddr host;
struct tf_fd fd;
+ struct tf_timeout to;
char buf[128];
int bytes = 0, r;
const char *req = "GET / HTTP/1.0\r\n\r\n";
@@ -27,7 +28,7 @@ static void ping_fiber(void *ptr)
if (r < 0)
goto err;
- r = tf_timed(tf_connect(&fd, &host), 10000);
+ r = tf_timed(&to, tf_connect(&fd, &host), 10000);
if (r < 0)
goto err_close;
@@ -49,11 +50,11 @@ int main(int argc, char **argv)
struct ctx *c;
int i;
- tf_scheduler_enable(NULL);
+ tf_vmach_start();
for (i = 1; i < argc; i++) {
c = tf_fiber_create(ping_fiber, sizeof(struct ctx));
c->hostname = argv[i];
- tf_fiber_put(c);
+ tf_fiber_run(c);
}
- tf_scheduler_disable();
+ tf_vmach_stop();
}