]> git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/gpsync.h
Import cups.org releases
[thirdparty/cups.git] / pstoraster / gpsync.h
1 /* Copyright (C) 1998 Aladdin Enterprises. All rights reserved.
2
3 This file is part of GNU Ghostscript.
4
5 GNU Ghostscript is distributed in the hope that it will be useful, but
6 WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
7 to anyone for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing. Refer
9 to the GNU General Public License for full details.
10
11 Everyone is granted permission to copy, modify and redistribute GNU
12 Ghostscript, but only under the conditions described in the GNU General
13 Public License. A copy of this license is supposed to have been given
14 to you along with GNU Ghostscript so you can know your rights and
15 responsibilities. It should be in a file named COPYING. Among other
16 things, the copyright notice and this notice must be preserved on all
17 copies.
18
19 Aladdin Enterprises supports the work of the GNU Project, but is not
20 affiliated with the Free Software Foundation or the GNU Project. GNU
21 Ghostscript, as distributed by Aladdin Enterprises, does not require any
22 GNU software to build or run it.
23 */
24
25 /*$Id$ */
26 /* Interface to platform-dependent synchronization primitives */
27
28 #if !defined(gpsync_INCLUDED)
29 #define gpsync_INCLUDED
30
31 /* Initial version 4/1/98 by John Desrosiers (soho@crl.com). */
32 /* 8/9/98 L. Peter Deutsch (ghost@aladdin.com) Changed ...sizeof to
33 procedures, added some comments. */
34
35 /* -------- Synchronization primitives ------- */
36
37 /*
38 * Semaphores support wait/signal semantics: a wait operation will allow
39 * control to proceed iff the number of signals since semaphore creation
40 * is greater than the number of waits.
41 */
42 typedef struct {
43 void *dummy_;
44 } gp_semaphore;
45
46 uint gp_semaphore_sizeof(P0());
47 /*
48 * Hack: gp_semaphore_open(0) succeeds iff it's OK for the memory manager
49 * to move a gp_semaphore in memory.
50 */
51 int gp_semaphore_open(P1(gp_semaphore * sema));
52 int gp_semaphore_close(P1(gp_semaphore * sema));
53 int gp_semaphore_wait(P1(gp_semaphore * sema));
54 int gp_semaphore_signal(P1(gp_semaphore * sema));
55
56 /*
57 * Monitors support enter/leave semantics: at most one thread can have
58 * entered and not yet left a given monitor.
59 */
60 typedef struct {
61 void *dummy_;
62 } gp_monitor;
63
64 uint gp_monitor_sizeof(P0());
65 /*
66 * Hack: gp_monitor_open(0) succeeds iff it's OK for the memory manager
67 * to move a gp_monitor in memory.
68 */
69 int gp_monitor_open(P1(gp_monitor * mon));
70 int gp_monitor_close(P1(gp_monitor * mon));
71 int gp_monitor_enter(P1(gp_monitor * mon));
72 int gp_monitor_leave(P1(gp_monitor * mon));
73
74 /*
75 * A new thread starts by calling a procedure, passing it a void * that
76 * allows it to gain access to whatever data it needs.
77 */
78 typedef void (*gp_thread_creation_callback_t) (P1(void *));
79 int gp_create_thread(P2(gp_thread_creation_callback_t, void *));
80
81 #endif /* !defined(gpsync_INCLUDED) */