Started work on select thread system.
[pazpar2-moved-to-github.git] / src / test_sel_thread.c
1 /* $Id: test_sel_thread.c,v 1.1 2007-04-20 10:06:52 adam Exp $
2    Copyright (c) 2006-2007, Index Data.
3
4 This file is part of Pazpar2.
5
6 Pazpar2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Pazpar2; see the file LICENSE.  If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20  */
21
22 #if HAVE_CONFIG_H
23 #include "cconfig.h"
24 #endif
25
26 #include "sel_thread.h"
27 #include <yaz/test.h>
28
29 struct my_work_data {
30     int x;
31 };
32
33 static void work_handler(void *vp)
34 {
35     struct my_work_data *p = vp;
36     p->x += 2;
37 }
38
39 static void test_1(void)
40 {
41     int fd;
42     sel_thread_t p = sel_thread_create(work_handler, &fd);
43     YAZ_CHECK(p);
44
45     sel_thread_destroy(p);
46 }
47
48 int main(int argc, char **argv)
49 {
50     YAZ_CHECK_INIT(argc, argv); 
51     YAZ_CHECK_LOG(); 
52
53     test_1();
54
55     YAZ_CHECK_TERM;
56 }
57
58
59
60
61 /*
62  * Local variables:
63  * c-basic-offset: 4
64  * indent-tabs-mode: nil
65  * End:
66  * vim: shiftwidth=4 tabstop=8 expandtab
67  */