Changeset 9954


Ignore:
Timestamp:
Jul 10, 2008, 9:10:38 AM (11 years ago)
Author:
gb
Message:

Import code from trunk (may contain early/inaccurate WINDOWS
conditionalization).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/lisp-kernel/Threads.h

    r7828 r9954  
    1616
    1717#include <stdlib.h>
     18#ifndef WINDOWS
    1819#include <unistd.h>
    1920#include <sys/mman.h>
     21#endif
    2022#include <stdio.h>
     23#ifndef WINDOWS
    2124#include <pthread.h>
     25#endif
    2226#include <errno.h>
    2327#include <limits.h>
     28
    2429#undef USE_MACH_SEMAPHORES
    25 #undef USE_POSIX_SEMAPHORES
     30#define USE_POSIX_SEMAPHORES
     31#undef USE_WINDOWS_SEMAPHORES
     32
    2633#ifdef DARWIN
    2734#define USE_MACH_SEMAPHORES 1
    28 #endif
    29 #ifndef USE_MACH_SEMAPHORES
    30 #define USE_POSIX_SEMAPHORES
     35#undef  USE_POSIX_SEMAPHORES
     36#endif
     37#ifdef WINDOWS
     38#define USE_WINDOWS_SEMAPHORES 1
     39#undef USE_POSIX_SEMAPHORES
     40#endif
     41
     42#ifdef USE_POSIX_SEMAPHORES
    3143#include <semaphore.h>
    3244#endif
     45
     46
    3347#ifdef USE_MACH_SEMAPHORES
    3448/* We have to use Mach semaphores, even if we're otherwise
     
    7084#define TCR_FROM_TSD(tsd) ((TCR *)((natural)(tsd)-TCR_BIAS))
    7185
     86#ifdef USE_WINDOWS_SEMAPHORES
     87
     88/* Unimplemented */
     89
     90typedef void * SEMAPHORE;
     91#define SEM_WAIT(s)
     92#define SEM_RAISE(s)
     93#define SEM_BROADCAST(s, count)
     94#define SEM_TIMEDWAIT(s,t)
     95
     96#endif
    7297#ifdef USE_POSIX_SEMAPHORES
    7398typedef sem_t * SEMAPHORE;
     
    94119#ifdef USE_MACH_SEMAPHORES
    95120#define SEM_WAIT_FOREVER(s) sem_wait_forever((SEMAPHORE)(natural)s)
     121#endif
     122
     123#ifdef USE_WINDOWS_SEMAPHORES
     124#define SEM_WAIT_FOREVER(s) sem_wait_forever((SEMAPHORE)s)
    96125#endif
    97126
     
    182211#define SIG_RESUME_THREAD (SIG_SUSPEND_THREAD+1)
    183212#else
    184 #define SIG_SUSPEND_THREAD SIGUSR1
    185 #define SIG_RESUME_THREAD SIGUSR2
     213#define SIG_SUSPEND_THREAD SIGUSR2
    186214#endif
    187215
    188216extern int thread_suspend_signal, thread_resume_signal;
     217
     218void *
     219allocate_stack(natural);
    189220
    190221void
Note: See TracChangeset for help on using the changeset viewer.