Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/thread/src/mac/thread_cleanup.cpp @ 29

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
11namespace boost {
12
13namespace threads {
14
15namespace mac {
16
17namespace detail {
18
19
20namespace {
21
22TaskStorageIndex g_ulIndex(0UL);
23
24} // anonymous namespace
25
26
27void 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
37void do_thread_cleanup()
38{
39    void (*pfnTask)() = MPGetTaskValue(g_ulIndex)
40}
41
42
43void 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.