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
90
91
92
93
94
95
96
97
98
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* This file was originally copied out of the firefox 38.0.1esr source tree from
* `js/src/vm/PosixNSPR.cpp` and modified to use the MongoDB threading primitives.
*
* The point of this file is to provide dummy implementations such that when the SpiderMonkey build
* looks for these symbols it will find symbols, thus permitting linkage. No code uses these
* entrypoints.
*/
#include "mongo/platform/basic.h"
#include <array>
#include <js/Utility.h>
#include <vm/PosixNSPR.h>
#include "mongo/platform/mutex.h"
#include "mongo/stdx/chrono.h"
#include "mongo/stdx/condition_variable.h"
#include "mongo/stdx/thread.h"
#include "mongo/util/concurrency/thread_name.h"
#include "mongo/util/time_support.h"
#define MONGO_MOZ_UNIMPLEMENTED(ReturnType, funcName, ...) \
ReturnType funcName(__VA_ARGS__) { \
MOZ_CRASH(#funcName " unimplemented"); \
}
MONGO_MOZ_UNIMPLEMENTED(void, mongo::mozjs::PR_BindThread, PRThread*);
MONGO_MOZ_UNIMPLEMENTED(PRThread*, mongo::mozjs::PR_CreateFakeThread);
MONGO_MOZ_UNIMPLEMENTED(void, mongo::mozjs::PR_DestroyFakeThread, PRThread*);
MONGO_MOZ_UNIMPLEMENTED(PRThread*,
PR_CreateThread,
PRThreadType,
void (*)(void*),
void*,
PRThreadPriority,
PRThreadScope,
PRThreadState,
uint32_t);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_JoinThread, PRThread*);
MONGO_MOZ_UNIMPLEMENTED(PRThread*, PR_GetCurrentThread);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_SetCurrentThreadName, const char*);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_NewThreadPrivateIndex, unsigned*, PRThreadPrivateDTOR);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_SetThreadPrivate, unsigned, void*);
MONGO_MOZ_UNIMPLEMENTED(void*, PR_GetThreadPrivate, unsigned);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_CallOnce, PRCallOnceType*, PRCallOnceFN);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_CallOnceWithArg, PRCallOnceType*, PRCallOnceWithArgFN, void*);
MONGO_MOZ_UNIMPLEMENTED(PRLock*, PR_NewLock);
MONGO_MOZ_UNIMPLEMENTED(void, PR_DestroyLock, PRLock*);
MONGO_MOZ_UNIMPLEMENTED(void, PR_Lock, PRLock*);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_Unlock, PRLock*);
MONGO_MOZ_UNIMPLEMENTED(PRCondVar*, PR_NewCondVar, PRLock*);
MONGO_MOZ_UNIMPLEMENTED(void, PR_DestroyCondVar, PRCondVar*);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_NotifyCondVar, PRCondVar*);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_NotifyAllCondVar, PRCondVar*);
MONGO_MOZ_UNIMPLEMENTED(uint32_t, PR_MillisecondsToInterval, uint32_t);
MONGO_MOZ_UNIMPLEMENTED(uint32_t, PR_MicrosecondsToInterval, uint32_t);
MONGO_MOZ_UNIMPLEMENTED(uint32_t, PR_TicksPerSecond);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_WaitCondVar, PRCondVar*, uint32_t);
MONGO_MOZ_UNIMPLEMENTED(int32_t, PR_FileDesc2NativeHandle, PRFileDesc*);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_GetOpenFileInfo, PRFileDesc*, PRFileInfo*);
MONGO_MOZ_UNIMPLEMENTED(int32_t, PR_Seek, PRFileDesc*, int32_t, PRSeekWhence);
MONGO_MOZ_UNIMPLEMENTED(PRFileMap*, PR_CreateFileMap, PRFileDesc*, int64_t, PRFileMapProtect);
MONGO_MOZ_UNIMPLEMENTED(void*, PR_MemMap, PRFileMap*, int64_t, uint32_t);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_MemUnmap, void*, uint32_t);
MONGO_MOZ_UNIMPLEMENTED(PRStatus, PR_CloseFileMap, PRFileMap*);
|