blob: 93ba0ababd316ec954914b9e1ea1c17d5675c2bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*++
Module Name:
include/pal/threadinfo.hpp
Abstract:
Header file for thread info initialzer
--*/
#ifndef _PAL_THREADINFO_H_
#define _PAL_THREADINFO_H_
#include "corunix.hpp"
namespace CorUnix
{
//
// There are a number of different functional areas for which we need to
// store per-thread data:
// * synchronization
// * structure exception handling
// * asynchronous procedure calls
// * thread suspension
// * thread-local storage
// * CRT per-thread buffers
//
// For each of the above functional areas we build a class that stores
// the necessary data. An instance of each of these classes is embedded
// in the main thread class. The classes must not have any failure paths
// in their constructors. Each class inherits from a common parent class
// that exposes two virtual initialization routines (which may return an
// error). The first initialization routine is called after the thread
// object is allocated, but before the new thread is created. Any
// initialization that is not dependant on knowledge of the new thread's
// ID (and by extension need not run in the context of the new thread)
// should take place in the first routine. Work that must run in the
// context of the new thread or that must know the new thread's ID
// should take place in the second initialization routine.
//
class CThreadInfoInitializer
{
public:
//
// InitializePreCreate is called before the new thread is started.
// Any allocations or other initializations that may fail that do
// not need to run in the context of the new thread (or know the
// new thread's ID) should take place in this routine.
//
virtual
PAL_ERROR
InitializePreCreate(
void
)
{
return NO_ERROR;
};
//
// InitializePostCreate is called from within the context of the
// new thread.
//
virtual
PAL_ERROR
InitializePostCreate(
CPalThread *pThread,
SIZE_T threadId,
DWORD dwLwpId
)
{
return NO_ERROR;
};
};
}
#endif // _PAL_THREADINFO_H_
|