src/os/bsd/vm/osThread_bsd.hpp

changeset 3587
0368109684cb
parent 3156
f08d439fab8c
child 3709
0105f367a14c
     1.1 --- a/src/os/bsd/vm/osThread_bsd.hpp	Fri Feb 17 15:55:27 2012 -0800
     1.2 +++ b/src/os/bsd/vm/osThread_bsd.hpp	Sun Feb 19 13:11:39 2012 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -40,10 +40,17 @@
    1.11   private:
    1.12  
    1.13  #ifdef _ALLBSD_SOURCE
    1.14 -  // _thread_id and _pthread_id are the same on BSD
    1.15 -  // keep both to minimize code divergence in os_bsd.cpp
    1.16 +
    1.17 +#ifdef __APPLE__
    1.18 +  thread_t  _thread_id;
    1.19 +#else
    1.20    pthread_t _thread_id;
    1.21 +#endif
    1.22 +
    1.23 +  // _pthread_id is the pthread id, which is used by library calls
    1.24 +  // (e.g. pthread_kill).
    1.25    pthread_t _pthread_id;
    1.26 +
    1.27  #else
    1.28    // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
    1.29    // thread has a unique thread_id (BsdThreads or NPTL). It can be used
    1.30 @@ -64,9 +71,15 @@
    1.31    void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
    1.32  
    1.33  #ifdef _ALLBSD_SOURCE
    1.34 +#ifdef __APPLE__
    1.35 +  thread_t thread_id() const {
    1.36 +    return _thread_id;
    1.37 +  }
    1.38 +#else
    1.39    pthread_t thread_id() const {
    1.40      return _thread_id;
    1.41    }
    1.42 +#endif
    1.43  #else
    1.44    pid_t thread_id() const {
    1.45      return _thread_id;
    1.46 @@ -84,9 +97,15 @@
    1.47    }
    1.48  #endif // ASSERT
    1.49  #ifdef _ALLBSD_SOURCE
    1.50 +#ifdef __APPLE__
    1.51 +  void set_thread_id(thread_t id) {
    1.52 +    _thread_id = id;
    1.53 +  }
    1.54 +#else
    1.55    void set_thread_id(pthread_t id) {
    1.56      _thread_id = id;
    1.57    }
    1.58 +#endif
    1.59  #else
    1.60    void set_thread_id(pid_t id) {
    1.61      _thread_id = id;

mercurial