2 * Unix SMB/CIFS implementation.
3 * Test pthreadpool_tevent
4 * Copyright (C) Volker Lendecke 2016
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "system/select.h"
23 #include "lib/pthreadpool/pthreadpool_tevent.h"
25 static void job_fn(void *private_data
);
27 bool run_pthreadpool_tevent(int dummy
)
29 struct tevent_context
*ev
;
30 struct pthreadpool_tevent
*pool
;
31 struct tevent_req
*req
;
35 ev
= tevent_context_init_byname(NULL
, "poll");
37 fprintf(stderr
, "tevent_context_init failed\n");
41 ret
= pthreadpool_tevent_init(ev
, 100, &pool
);
43 fprintf(stderr
, "pthreadpool_tevent_init failed: %s\n",
50 req
= pthreadpool_tevent_job_send(ev
, ev
, pool
, job_fn
, &val
);
52 fprintf(stderr
, "pthreadpool_tevent_job_send failed\n");
56 ok
= tevent_req_poll(req
, ev
);
58 fprintf(stderr
, "tevent_req_poll failed\n");
62 ret
= pthreadpool_tevent_job_recv(req
);
64 fprintf(stderr
, "pthreadpool_tevent_job failed: %s\n",
76 static void job_fn(void *private_data
)
78 int *pret
= private_data
;