1 /* $Id: sel_thread.h,v 1.1 2007-04-20 10:06:52 adam Exp $
2 Copyright (c) 2006-2007, Index Data.
4 This file is part of Pazpar2.
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
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
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
24 #include <yaz/yconfig.h>
28 /** \brief select thread handler type */
29 typedef struct sel_thread *sel_thread_t;
31 /** \brief creates select thread
32 \param work_handler handler that does work in worker thread
33 \param read_fd pointer to readable socket upon completion
34 \returns select thread handler
36 Creates a worker thread. The worker thread will signal "completed"
37 work by sending one byte to the read_fd file descriptor.
38 You are supposed to select or poll on that for reading and
39 call sel_thread_result accordingly.
41 sel_thread_t sel_thread_create(void (*work_handler)(void *work_data),
44 /** \brief destorys select thread
45 \param p select thread handler
47 void sel_thread_destroy(sel_thread_t p);
49 /** \brief adds work to be carried out in thread
50 \param p select thread handler
51 \param data pointer to data that work_handler knows about
53 void sel_thread_add(sel_thread_t p, void *data);
55 /** \brief gets result of work
56 \param p select thread handler
57 \returns data for work (which work_handler has been working on)
59 void *sel_thread_result(sel_thread_t p);
70 * indent-tabs-mode: nil
72 * vim: shiftwidth=4 tabstop=8 expandtab