Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/runtime/include/ml-mp.h
ViewVC logotype

Annotation of /sml/trunk/src/runtime/include/ml-mp.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 249 - (view) (download) (as text)
Original Path: sml/branches/SMLNJ/src/runtime/include/ml-mp.h

1 : monnier 249 /* ml-mp.h
2 :     *
3 :     * COPYRIGHT (c) 1994 by AT&T Bell Laboratories.
4 :     */
5 :    
6 :     #ifndef _ML_MP_
7 :     #define _ML_MP_
8 :    
9 :     /* The status of a virtual processor */
10 :     typedef enum {
11 :     MP_PROC_RUNNING, /* processor is running */
12 :     MP_PROC_SUSPENDED, /* processor is suspended */
13 :     MP_PROC_NO_PROC /* no processor allocated */
14 :     } vproc_status_t;
15 :    
16 :     #ifdef MP_SUPPORT
17 :    
18 :     #if !defined(SOFT_POLL) || !defined(MP_GCPOLL)
19 :     # error MP runtime currently requires polling support
20 :     #endif
21 :    
22 :     /*** OS dependent stuff ***/
23 :    
24 :     #if defined(OPSYS_IRIX5)
25 :     #include <sys/types.h>
26 :     #include <sys/prctl.h>
27 :     #include <unistd.h>
28 :     #include <ulocks.h>
29 :    
30 :     typedef ulock_t mp_lock_t; /* A lock */
31 :     typedef barrier_t mp_barrier_t; /* A barrier */
32 :     typedef int mp_pid_t; /* A process id */
33 :    
34 :     #else
35 :     # error MP not supported for this system
36 :     #endif
37 :    
38 :    
39 :     /*** Generic MP interface ***/
40 :    
41 :     extern int MP_StartCollect(ml_state_t *);
42 :     extern void MP_FinishCollect(ml_state_t *,int);
43 :     extern ml_val_t *mpExtraRoots[];
44 :    
45 :     extern void MP_SetLock (mp_lock_t lock);
46 :     extern void MP_UnsetLock (mp_lock_t lock);
47 :     extern bool_t MP_TryLock (mp_lock_t lock);
48 :     extern mp_lock_t MP_AllocLock ();
49 :     extern void MP_FreeLock (mp_lock_t lock);
50 :    
51 :     extern mp_barrier_t *MP_AllocBarrier ();
52 :     extern void MP_FreeBarrier (mp_barrier_t *barrierp);
53 :     extern void MP_Barrier (mp_barrier_t *barrierp, unsigned n);
54 :     extern void MP_ResetBarrier (mp_barrier_t *barrierp);
55 :    
56 :     extern mp_pid_t MP_ProcId (void);
57 :     extern int MP_MaxProcs ();
58 :     extern ml_val_t MP_AcquireProc (ml_state_t *msp, ml_val_t arg);
59 :     extern void MP_ReleaseProc (ml_state_t *msp);
60 :     extern int MP_ActiveProcs ();
61 :     extern void MP_Init (void);
62 :     extern void MP_Shutdown (void);
63 :    
64 :     extern mp_lock_t MP_GCLock;
65 :     extern mp_lock_t MP_GCGenLock;
66 :     extern mp_lock_t MP_TimerLock;
67 :     extern mp_barrier_t *MP_GCBarrier;
68 :    
69 :     #define BEGIN_CRITICAL_SECT(LOCK) { MP_SetLock(LOCK); {
70 :     #define END_CRITICAL_SECT(LOCK) } MP_UnsetLock(LOCK); }
71 :     #define ACQUIRE_LOCK(LOCK) MP_SetLock(LOCK);
72 :     #define RELEASE_LOCK(LOCK) MP_UnsetLock(LOCK);
73 :    
74 :     #else /* !MP_SUPPORT */
75 :    
76 :     #define BEGIN_CRITICAL_SECT(LOCK) {
77 :     #define END_CRITICAL_SECT(LOCK) }
78 :     #define ACQUIRE_LOCK(LOCK) /* no operation */
79 :     #define RELEASE_LOCK(LOCK) /* no operation */
80 :    
81 :     #endif /* MP_SUPPORT */
82 :    
83 :     #endif /* !_ML_MP_ */
84 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0