Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tasklet.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2002 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021 
00022 #ifndef __AWTASKLET__
00023 #define __AWTASKLET__
00024 
00025 #include "monthread.h"
00026 
00027 /* cap on number of tasklets per pool, safety check */
00028 #define MAX_POOL_TASKLETS 1024
00029 
00037 typedef struct aw_tasklet_thread_s {
00038 
00039   struct aw_tasklet_thread_s 
00040    *next,*prev;
00041 
00042   aw_plock_t
00043    lock;
00044 
00045   /* non-zero if busy */
00046   u_int32_t
00047    working;
00048 
00049   /* non-zero if requested to stop */
00050   u_int32_t
00051    stop;
00052 
00053   aw_monthread_t
00054    *thread;
00055 
00056   struct aw_tasklet_pool_s
00057    *pool;
00058 
00059   void
00060    *params;
00061 
00062 } aw_tasklet_thread_t;
00063 
00064 typedef struct aw_tasklet_pool_s {
00065 
00066   aw_plock_t
00067    lock;
00068 
00069   u_int32_t
00070    stop;
00071 
00072   aw_tasklet_thread_t
00073    *threads;
00074 
00075 } aw_tasklet_pool_t;
00076 
00077 
00078 typedef struct {
00079 
00080   aw_handler_t *h;
00081 
00082   aw_handler_args_t args;
00083 
00084 } aw_handler_tasklet_params_t;
00085 
00086 
00087 /* tasklet.c */
00088 void aw_init_tasklet_pool(aw_tasklet_pool_t *pool);
00089 void aw_clear_tasklet_pool(aw_tasklet_pool_t *pool);
00090 int32_t aw_start_handler_tasklet(aw_handler_t *h, aw_handler_args_t *args);
00091 
00092 #endif
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)