Files
gcc/libphobos/testsuite/libphobos.thread/tlsstack.d
Iain Buclaw b3b54f9c9a libphobos: Merge changes in upstream druntime testsuite
libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime d2ee11364c.
	* testsuite/libphobos.aa/test_aa.d: Add new test.
	* testsuite/libphobos.betterc/test19933.d: Adjust imports.
	* testsuite/libphobos.config/test22523.d: Likewise.
	* testsuite/libphobos.exceptions/assert_fail.d: Adjust test.
	* testsuite/libphobos.exceptions/chain.d: Adjust imports.
	* testsuite/libphobos.exceptions/future_message.d: Likewise.
	* testsuite/libphobos.exceptions/line_trace.d: Likewise.
	* testsuite/libphobos.exceptions/long_backtrace_trunc.d: Likewise.
	* testsuite/libphobos.exceptions/static_dtor.d: Likewise.
	* testsuite/libphobos.gc/forkgc.d: Likewise.
	* testsuite/libphobos.gc/precisegc.d: Likewise.
	* testsuite/libphobos.gc/recoverfree.d: Likewise.
	* testsuite/libphobos.hash/test_hash.d: Likewise.
	* testsuite/libphobos.init_fini/custom_gc.d: Likewise.
	* testsuite/libphobos.init_fini/thread_join.d: Likewise.
	* testsuite/libphobos.thread/external_threads.d: Likewise.
	* testsuite/libphobos.thread/fiber_guard_page.d: Likewise.
	* testsuite/libphobos.thread/tlsgc_sections.d: Likewise.
	* testsuite/libphobos.thread/tlsstack.d: Likewise.
	* testsuite/libphobos.unittest/customhandler.d: Likewise.
2025-03-18 18:53:11 +01:00

39 lines
870 B
D

module core.thread.test; // needs access to getStackTop()/getStackBottom()
import core.stdc.stdio : printf;
import core.thread;
ubyte[16384] data;
void showThreadInfo() nothrow
{
try
{
auto top = getStackTop();
auto bottom = getStackBottom();
printf("tlsdata: %p\n", data.ptr);
printf("stack top: %p\n", getStackTop());
printf("stack bottom:%p\n", getStackBottom());
printf("used stack: %lld\n", cast(ulong)(bottom - top));
}
catch(Exception e)
{
assert(false, e.msg);
}
}
void main()
{
printf("### main\n");
showThreadInfo();
printf("### thread\n");
auto th = new Thread(&showThreadInfo, 16384);
th.start();
th.join();
printf("### lowlevel thread\n");
auto llth = createLowLevelThread(() { showThreadInfo(); });
joinLowLevelThread(llth);
}