1*b1e83836Smrg module core.thread.test; // needs access to getStackTop()/getStackBottom() 2*b1e83836Smrg 3*b1e83836Smrg import core.stdc.stdio; 4*b1e83836Smrg import core.thread; 5*b1e83836Smrg 6*b1e83836Smrg ubyte[16384] data; 7*b1e83836Smrg showThreadInfo()8*b1e83836Smrgvoid showThreadInfo() nothrow 9*b1e83836Smrg { 10*b1e83836Smrg try 11*b1e83836Smrg { 12*b1e83836Smrg auto top = getStackTop(); 13*b1e83836Smrg auto bottom = getStackBottom(); 14*b1e83836Smrg printf("tlsdata: %p\n", data.ptr); 15*b1e83836Smrg printf("stack top: %p\n", getStackTop()); 16*b1e83836Smrg printf("stack bottom:%p\n", getStackBottom()); 17*b1e83836Smrg printf("used stack: %lld\n", cast(ulong)(bottom - top)); 18*b1e83836Smrg } 19*b1e83836Smrg catch(Exception e) 20*b1e83836Smrg { 21*b1e83836Smrg assert(false, e.msg); 22*b1e83836Smrg } 23*b1e83836Smrg } 24*b1e83836Smrg main()25*b1e83836Smrgvoid main() 26*b1e83836Smrg { 27*b1e83836Smrg printf("### main\n"); 28*b1e83836Smrg showThreadInfo(); 29*b1e83836Smrg 30*b1e83836Smrg printf("### thread\n"); 31*b1e83836Smrg auto th = new Thread(&showThreadInfo, 16384); 32*b1e83836Smrg th.start(); 33*b1e83836Smrg th.join(); 34*b1e83836Smrg 35*b1e83836Smrg printf("### lowlevel thread\n"); 36*b1e83836Smrg auto llth = createLowLevelThread(() { showThreadInfo(); }); 37*b1e83836Smrg joinLowLevelThread(llth); 38*b1e83836Smrg } 39