...
 
Commits (5)
......@@ -31,6 +31,7 @@
//! the file.
#pike __REAL_VERSION__
#require constant(Thread.Thread)
#define POLLINTERVAL 4
......
......@@ -41,7 +41,9 @@ void set_delay( int t )
delay = t;
}
#if constant(all_threads)
protected object backend_thread = this_thread();
#endif
protected int delay, last_seen;
protected int expected_cpu_time;
protected array(function(void:void)) debug_funcs = ({});
......@@ -51,13 +53,18 @@ protected array(function(void:bool)) probes = ({});
//! debug information to stderr.
void print_debug()
{
#if constant(_disable_threads)
// Disable all threads to avoid potential locking problems while we
// have the backtraces. It also gives an atomic view of the state.
object threads_disabled = _disable_threads();
#else
object threads_disabled = 0;
#endif
gc();
Stdio.stderr.write("### Describing all Pike threads:\n\n");
int n;
#if constant(all_threads)
foreach( all_threads(), Thread.Thread t )
{
array bt = t->backtrace();
......@@ -66,6 +73,15 @@ void print_debug()
Stdio.stderr.write(describe_backtrace(bt) + "\n");
n++;
}
#else
{
array bt = backtrace();
Stdio.stderr.write("### Thread %O%s:\n",
UNDEFINED, " (backend thread)");
Stdio.stderr.write(describe_backtrace(bt) + "\n");
n++;
}
#endif
Stdio.stderr.write("Total %d Pike threads\n", n);
......
......@@ -3,6 +3,8 @@
// WebSocket testsuite
//
#if constant(Thread.Thread)
constant loopback = "127.0.0.1";
int successes;
......@@ -306,3 +308,12 @@ int main(int argc, array(string) argv)
Thread.thread_create(run_tests);
return -1;
}
#else
int main(int argc, array(string) argv)
{
Tools.Testsuite.report_result(0, 0, 1);
}
#endif
......@@ -234,12 +234,16 @@ define(run_sub_test, [[
]])
]])
cond_begin([[all_constants()->thread_create]])
dnl Displaced tests for SSL.File.
run_sub_test(({"SRCDIR../../../src/modules/_Stdio/async_tls_close_test.pike", "0", "0"}))
run_sub_test(({"SRCDIR../../../src/modules/_Stdio/async_tls_close_test.pike", "0", "1"}))
run_sub_test(({"SRCDIR../../../src/modules/_Stdio/async_tls_close_test.pike", "1", "0"}))
run_sub_test(({"SRCDIR../../../src/modules/_Stdio/async_tls_close_test.pike", "1", "1"}))
cond_end // thread_create
test_do([[
#define ASSERT(X) if(!(X)) error("Assertion failed.\n")
......
......@@ -461,7 +461,7 @@ int|object streaming_query(object|string q,
return big_query(q, bindings);
}
#else
#elif constant(Sql.pgsql)
/*
* If libpq wasn't available at compile time, the pgsql-module can provide
* near the same functionality as the postgres module.
......@@ -479,4 +479,6 @@ int|object streaming_query(object|string q,
//! @seealso
//! @[Sql.pgsql], @[Sql.Sql]
inherit Sql.pgsql;
#endif /* constant(Postgres.postgres) */
#else /* constant(Sql.pgsql) */
constant this_program_does_not_exist = 1;
#endif