Last change
on this file since 29 was
29,
checked in by landauf, 17 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1006 bytes
|
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 "thread_cleanup.hpp" |
---|
9 | |
---|
10 | |
---|
11 | namespace boost { |
---|
12 | |
---|
13 | namespace threads { |
---|
14 | |
---|
15 | namespace mac { |
---|
16 | |
---|
17 | namespace detail { |
---|
18 | |
---|
19 | |
---|
20 | namespace { |
---|
21 | |
---|
22 | TaskStorageIndex g_ulIndex(0UL); |
---|
23 | |
---|
24 | } // anonymous namespace |
---|
25 | |
---|
26 | |
---|
27 | void do_thread_startup() |
---|
28 | { |
---|
29 | if(g_ulIndex == 0UL) |
---|
30 | { |
---|
31 | OSStatus lStatus = MPAllocateTaskStorageIndex(&g_ulIndex); |
---|
32 | assert(lStatus == noErr); |
---|
33 | } |
---|
34 | set_thread_cleanup_task(NULL); |
---|
35 | } |
---|
36 | |
---|
37 | void do_thread_cleanup() |
---|
38 | { |
---|
39 | void (*pfnTask)() = MPGetTaskValue(g_ulIndex) |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | void set_thread_cleanup_task(void (*pfnTask)()) |
---|
44 | { |
---|
45 | lStatus = MPSetTaskValue(g_ulIndex, reinterpret_cast<TaskStorageValue>(pfnTask)); |
---|
46 | assert(lStatus == noErr); |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | } // namespace detail |
---|
51 | |
---|
52 | } // namespace mac |
---|
53 | |
---|
54 | } // namespace threads |
---|
55 | |
---|
56 | } // namespace boost |
---|
Note: See
TracBrowser
for help on using the repository browser.