~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to otherlibs/win32unix/winworker.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Zacchiroli
  • Date: 2009-02-22 08:49:13 UTC
  • mfrom: (12.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090222084913-3i0uw2bhd0lgw0ok
* Uploading to unstable
* debian/control: bump dh-ocaml to (>= 0.4) to avoid buggy ocamlinit.mk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************************/
 
2
/*                                                                     */
 
3
/*                           Objective Caml                            */
 
4
/*                                                                     */
 
5
/*  Contributed by Sylvain Le Gall for Lexifi                          */
 
6
/*                                                                     */
 
7
/*  Copyright 2008 Institut National de Recherche en Informatique et   */
 
8
/*  en Automatique.  All rights reserved.  This file is distributed    */
 
9
/*  under the terms of the GNU Library General Public License, with    */
 
10
/*  the special exception on linking described in file ../../LICENSE.  */
 
11
/*                                                                     */
 
12
/***********************************************************************/
 
13
 
 
14
/* $Id: winworker.h,v 1.2 2008/07/31 12:09:18 xleroy Exp $ */
 
15
#ifndef _WINWORKER_H
 
16
#define _WINWORKER_H
 
17
 
 
18
#define _WIN32_WINNT 0x0400
 
19
#include <windows.h>
 
20
 
 
21
/* Pool of worker threads. 
 
22
 *
 
23
 * These functions help to manage a pool of worker thread and submit task to
 
24
 * the pool. It helps to reduce the number of thread creation.
 
25
 *
 
26
 * Each worker are started in alertable wait state and jobs are submitted as 
 
27
 * APC (asynchronous procedure call).
 
28
 */
 
29
 
 
30
/* Data associated with submitted job */
 
31
typedef struct _WORKER WORKER;
 
32
typedef WORKER *LPWORKER;
 
33
 
 
34
/* Function type of submitted job:
 
35
 * void worker_call (HANDLE hStop, void *data)
 
36
 *
 
37
 * This function will be called using the data following:
 
38
 * - hStop must be watched for change, since it represents an external command
 
39
 *   to stop the call. This event is shared through the WORKER structure, which
 
40
 *   can be access throuhg worker_job_event_done.
 
41
 * - data is user provided data for the function.
 
42
 */
 
43
typedef void (*WORKERFUNC) (HANDLE, void *);
 
44
 
 
45
/* Initialize global data structure for worker 
 
46
 */
 
47
void worker_init (void);
 
48
 
 
49
/* Free global data structure for worker 
 
50
 */
 
51
void worker_cleanup (void);
 
52
 
 
53
/* Submit a job to worker. Use returned data to synchronize with the procedure
 
54
 * submitted. 
 
55
 */
 
56
LPWORKER worker_job_submit (WORKERFUNC f, void *data);
 
57
 
 
58
/* Get event to know when a job is done.
 
59
 */
 
60
HANDLE worker_job_event_done (LPWORKER);
 
61
 
 
62
/* Ask a job to stop processing.
 
63
 */
 
64
void worker_job_stop (LPWORKER);
 
65
 
 
66
/* End a job submitted to worker. 
 
67
 */
 
68
void worker_job_finish (LPWORKER);
 
69
 
 
70
#endif /* _WINWORKER_H */