blob: 712bdf2cfd98df69594515a76258cfa97eb7c78a (
plain) (
blame)
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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
static void
bomb(void)
{
char *p;
p = NULL;
*p = 4;
}
class FastS_Bomber : public FastOS_Runnable
{
void Run(FastOS_ThreadInterface *thread, void *arg)
{
(void) thread;
(void) arg;
bomb();
}
};
static int
bombMain(void)
{
FastOS_ThreadPool *pool = new FastOS_ThreadPool(128*1024);
FastS_Bomber bomber;
FastOS_ThreadInterface *thread;
thread = pool->NewThread(&bomber, NULL);
if (thread != NULL)
thread->Join();
pool->Close();
delete pool;
return (0);
}
class FastS_CoreTestApp : public FastOS_Application
{
public:
FastS_CoreTestApp(void) { }
~FastS_CoreTestApp(void) { }
int Main(void);
};
int
FastS_CoreTestApp::Main(void)
{
return bombMain();
}
int
main(int argc, char **argv)
{
FastS_CoreTestApp app;
setvbuf(stdout, NULL, _IOLBF, 8192);
if (argc == 1)
return app.Entry(argc, argv);
else
return bombMain();
}
|