Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

at_win32_thread.cpp File Reference

#include "at_assert.h"
#include "at_thread.h"
#include <windows.h>
#include <process.h>
#include <iostream>
#include <sstream>
#include <new>
#include "at_trace.h"

Include dependency graph for at_win32_thread.cpp:

Include dependency graph

Namespaces

namespace  at

Compounds

struct  PrivateConditionalContext
struct  PrivateMutexContext
class  SpinLock
class  SpinLocker

Defines

#define ReferenceMutexContext(i_name)   PrivateMutexContext * i_name = reinterpret_cast<PrivateMutexContext *>( & m_mutex_context )
#define ReferenceConditionalContext(i_name)

Functions

const SYSTEM_INFO & GetSystemInfoR ()
unsigned GetCpuCount ()
unsigned GetDefaultSpinCount ()
 AT_StaticAssert (sizeof(at::Mutex::MutexContext) >=sizeof(PrivateMutexContext), Mutex__MutexContext_size_must_be_greater_or_equal_to_size_of_PrivateMutexContext)
 AT_StaticAssert (sizeof(at::Conditional::ConditionalContext) >=sizeof(PrivateConditionalContext), Conditional__ConditionalContext_size_must_be_greater_or_equal_to_size_of_pthread_cond_t)

Define Documentation

#define ReferenceConditionalContext i_name   
 

Value:

PrivateConditionalContext * i_name =                                \
        reinterpret_cast<PrivateConditionalContext *>( & m_conditional_context )

#define ReferenceMutexContext i_name       PrivateMutexContext * i_name = reinterpret_cast<PrivateMutexContext *>( & m_mutex_context )
 


Function Documentation

AT_StaticAssert sizeof(at::Conditional::ConditionalContext) >=sizeof(PrivateConditionalContext  ,
Conditional__ConditionalContext_size_must_be_greater_or_equal_to_size_of_pthread_cond_t   
 

AT_StaticAssert sizeof(at::Mutex::MutexContext) >=sizeof(PrivateMutexContext  ,
Mutex__MutexContext_size_must_be_greater_or_equal_to_size_of_PrivateMutexContext   
 

unsigned GetCpuCount  
 

Uniprocessor systems should (in theory) not do too much spinning on spin locks. GetCpuCount will return the count of CPUs.

unsigned GetDefaultSpinCount  
 

GetDefaultSpinCount computes the number of spins based on the number of CPUs. Single CPU machines don't need to spin, while SMP machines benefit from spinning at least enough cycles that would allow a cache line to be refectched. This is of the order of 1000 cycles on most modern systems.

Returns:
a default spin count

const SYSTEM_INFO& GetSystemInfoR  
 

This is like the windows system call except it returns the GetSystemInfo data.

Returns:
a const reference to a statically allocated SYSTEM_INFO object.

Generated for Austria by doxygen and MakeXS at Sun Oct 24 17:35:34 PDT 2004