Line | |
---|
1 | // (C) Copyright Mac Murrett 2001. |
---|
2 | // Use, modification and distribution are subject to the |
---|
3 | // Boost Software License, Version 1.0. (See accompanying file |
---|
4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
5 | |
---|
6 | // See http://www.boost.org for most recent version. |
---|
7 | |
---|
8 | #include "os.hpp" |
---|
9 | |
---|
10 | |
---|
11 | #include <cassert> |
---|
12 | |
---|
13 | #include <Gestalt.h> |
---|
14 | |
---|
15 | |
---|
16 | namespace boost { |
---|
17 | |
---|
18 | namespace threads { |
---|
19 | |
---|
20 | namespace mac { |
---|
21 | |
---|
22 | namespace os { |
---|
23 | |
---|
24 | |
---|
25 | // read the OS version from Gestalt |
---|
26 | static inline long get_version() |
---|
27 | { |
---|
28 | long lVersion; |
---|
29 | OSErr nErr = Gestalt(gestaltSystemVersion, &lVersion); |
---|
30 | assert(nErr == noErr); |
---|
31 | return(lVersion); |
---|
32 | } |
---|
33 | |
---|
34 | |
---|
35 | // check if we're running under Mac OS X and cache that information |
---|
36 | bool x() |
---|
37 | { |
---|
38 | static bool bX = (version() >= 0x1000); |
---|
39 | return(bX); |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | // read the OS version and cache it |
---|
44 | long version() |
---|
45 | { |
---|
46 | static long lVersion = get_version(); |
---|
47 | return(lVersion); |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | } // namespace os |
---|
52 | |
---|
53 | } // namespace mac |
---|
54 | |
---|
55 | } // namespace threads |
---|
56 | |
---|
57 | } // namespace boost |
---|
Note: See
TracBrowser
for help on using the repository browser.