/* Synchronization code, to be thread safe. */
-static CRITICAL_SECTION plist_cs;
+#ifdef CERT
-void
-__gnat_plist_init (void)
-{
- InitializeCriticalSection (&plist_cs);
-}
+/* For the Cert run times on native Windows we use dummy functions
+ for locking and unlocking tasks since we do not support multiple
+ threads on this configuration (Cert run time on native Windows). */
-static void
-plist_enter (void)
-{
- EnterCriticalSection (&plist_cs);
-}
+void dummy (void) {}
-static void
-plist_leave (void)
-{
- LeaveCriticalSection (&plist_cs);
-}
+void (*Lock_Task) () = &dummy;
+void (*Unlock_Task) () = &dummy;
+
+#else
+
+#define Lock_Task system__soft_links__lock_task
+extern void (*Lock_Task) (void);
+
+#define Unlock_Task system__soft_links__unlock_task
+extern void (*Unlock_Task) (void);
+
+#endif
typedef struct _process_list
{
pl = (Process_List *) xmalloc (sizeof (Process_List));
- plist_enter();
-
/* -------------------- critical section -------------------- */
+ (*Lock_Task) ();
+
pl->h = h;
pl->next = PLIST;
PLIST = pl;
++plist_length;
- /* -------------------- critical section -------------------- */
- plist_leave();
+ (*Unlock_Task) ();
+ /* -------------------- critical section -------------------- */
}
static void
Process_List *pl;
Process_List *prev = NULL;
- plist_enter();
-
/* -------------------- critical section -------------------- */
+ (*Lock_Task) ();
+
pl = PLIST;
while (pl)
{
}
--plist_length;
- /* -------------------- critical section -------------------- */
- plist_leave();
+ (*Unlock_Task) ();
+ /* -------------------- critical section -------------------- */
}
static int
}
k = 0;
- plist_enter();
+
+ /* -------------------- critical section -------------------- */
+ (*Lock_Task) ();
hl_len = plist_length;
- /* -------------------- critical section -------------------- */
hl = (HANDLE *) xmalloc (sizeof (HANDLE) * hl_len);
pl = PLIST;
hl[k++] = pl->h;
pl = pl->next;
}
- /* -------------------- critical section -------------------- */
- plist_leave();
+ (*Unlock_Task) ();
+ /* -------------------- critical section -------------------- */
res = WaitForMultipleObjects (hl_len, hl, FALSE, INFINITE);
h = hl[res - WAIT_OBJECT_0];
given that we have set Max_Digits etc with this in mind */
__gnat_init_float ();
-#ifndef RTX
- /* Initialize a lock for a process handle list - see adaint.c for the
- implementation of __gnat_portable_no_block_spawn, __gnat_portable_wait */
- __gnat_plist_init();
-#endif
-
/* Note that we do not activate this for the compiler itself to avoid a
bootstrap path problem. Older version of gnatbind will generate a call
to __gnat_initialize() without argument. Therefore we cannot use eh in