Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/thread/src/mac/execution_context.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: 1.3 KB
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 <Debugging.h>
9#include <Multiprocessing.h>
10
11#include "execution_context.hpp"
12#include "init.hpp"
13
14
15namespace boost {
16
17namespace threads {
18
19namespace mac {
20
21
22execution_context_t execution_context()
23{
24// make sure that MP services are available the first time through
25    static bool bIgnored = detail::thread_init();
26
27// first check if we're an MP task
28    if(MPTaskIsPreemptive(kInvalidID))
29    {
30        return(k_eExecutionContextMPTask);
31    }
32
33#if TARGET_CARBON
34// Carbon has TaskLevel
35    UInt32 ulLevel = TaskLevel();
36
37    if(ulLevel == 0UL)
38    {
39        return(k_eExecutionContextSystemTask);
40    }
41
42    if(ulLevel & kInDeferredTaskMask)
43    {
44        return(k_eExecutionContextDeferredTask);
45    }
46
47    return(k_eExecutionContextOther);
48#else
49// this can be implemented using TaskLevel if you don't mind linking against
50//    DebugLib (and therefore breaking Mac OS 8.6 support), or CurrentExecutionLevel.
51#    error execution_context unimplimented
52#endif
53}
54
55
56} // namespace mac
57
58} // namespace threads
59
60} // namespace boost
Note: See TracBrowser for help on using the repository browser.