Changeset 8805


Ignore:
Timestamp:
Mar 17, 2008, 7:07:47 AM (12 years ago)
Author:
gb
Message:

If USE_WINDOWS_SEMAPHORES, use windows semaphores.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/win64/lisp-kernel/thread_manager.c

    r8785 r8805  
    335335    status = SEM_TIMEDWAIT(s,&q);
    336336#endif
     337#ifdef USE_WINDOWS_SEMAPHORES
     338    status = (WaitForSingleObject(s,1000L) == WAIT_TIMEOUT) ? 1 : 0;
     339#endif
    337340  } while (status != 0);
    338341}
     
    341344wait_on_semaphore(void *s, int seconds, int millis)
    342345{
     346#ifdef USE_POSIX_SEMAPHORES
    343347  int nanos = (millis % 1000) * 1000000;
    344 #ifdef USE_POSIX_SEMAPHORES
    345348  int status;
    346349
     
    362365#endif
    363366#ifdef USE_MACH_SEMAPHORES
     367  int nanos = (millis % 1000) * 1000000;
    364368  mach_timespec_t q = {seconds, nanos};
    365369  int status = SEM_TIMEDWAIT(s, q);
     
    372376  default: return EINVAL;
    373377  }
     378#endif
     379#ifdef USE_WINDOWS_SEMAPHORES
     380  switch (WaitForSingleObject(s, seconds*1000L+(DWORD)millis)) {
     381  case WAIT_OBJECT_0:
     382    return 0;
     383  case WAIT_TIMEOUT:
     384    return WAIT_TIMEOUT;
     385  default:
     386    break;
     387  }
     388  return EINVAL;
    374389
    375390#endif
     
    544559  return (void *)(natural)s;
    545560#endif
     561#ifdef USE_WINDOWS_SEMAPHORES
     562  return CreateSemaphore(NULL, count, 0x7fffL, NULL);
     563#endif
    546564}
    547565
     
    590608    semaphore_destroy(mach_task_self(),((semaphore_t)(natural) *s));
    591609#endif
     610#ifdef USE_WINDOWS_SEMAPHORES
     611    CloseHandle(*s);
     612#endif
    592613    *s=NULL;
    593614  }
     
    598619tsd_set(LispObj key, void *datum)
    599620{
     621  TlsSetValue((DWORD)key, datum);
    600622}
    601623
     
    603625tsd_get(LispObj key)
    604626{
     627  TlsGetValue((DWORD)key);
    605628}
    606629#else
Note: See TracChangeset for help on using the changeset viewer.