3 Copyright 2001 Red Hat Inc.
5 Written by Robert Collins <rbtcollins@hotmail.com>
7 This file is part of Cygwin.
9 This software is a copyrighted work licensed under the terms of the
10 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
13 #ifndef _THREADED_QUEUE_
14 #define _THREADED_QUEUE_
16 /* a specific request */
21 class queue_request *next;
22 virtual void process ();
27 typedef DWORD WINAPI threaded_queue_thread_function (LPVOID);
28 /* parameters for a request finding and submitting loop */
30 class queue_process_param
33 bool start (threaded_queue_thread_function *, class threaded_queue *);
37 class queue_process_param * next;
38 class threaded_queue *queue;
39 queue_process_param (bool ninterruptible);
40 ~queue_process_param ();
47 /* a queue to allocate requests from n submission loops to x worker threads */
52 CRITICAL_SECTION queuelock;
55 queue_request * request;
56 unsigned int initial_workers;
58 void create_workers ();
60 void add (queue_request *);
61 void process_requests (queue_process_param *, threaded_queue_thread_function *);
62 threaded_queue () : active (false), request (NULL), initial_workers (1), running (0), process_head (NULL) {};
64 queue_request *process_head;
67 #endif /* _THREADED_QUEUE_ */