Skip to content

Commit e7f8129

Browse files
committed
Build and tests should work when APR doesn't support threads.
* auth/auth.c (cleanup_user_scheme): Don't call init_authn_schemes_guard() explicitly. * test/MockHTTPinC/MockHTTP_server.c (run_thread): Define function only if APR supports threads. (mhStartServer, mhStopServer): Move threading-specific local variables inside the APR_HAS_THREADS conditional block. git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1931478 13f79535-47bb-0310-9956-ffa450edef68
1 parent 7320fea commit e7f8129

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

auth/auth.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,7 @@ static apr_status_t cleanup_user_scheme(void* data)
621621
const serf__authn_scheme_t *slot = NULL;
622622
int index;
623623

624-
apr_status_t lock_status = init_authn_schemes_guard(NULL);
625-
if (!lock_status)
626-
lock_status = lock_authn_schemes(NULL);
624+
apr_status_t lock_status = lock_authn_schemes(NULL);
627625
if (lock_status)
628626
return lock_status;
629627

test/MockHTTPinC/MockHTTP_server.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ struct _mhClientCtx_t {
133133
/**
134134
* Start up a server in a separate thread.
135135
*/
136+
#if APR_HAS_THREADS
136137
static void * APR_THREAD_FUNC run_thread(apr_thread_t *tid, void *baton)
137138
{
138139
mhServCtx_t *ctx = baton;
@@ -144,6 +145,7 @@ static void * APR_THREAD_FUNC run_thread(apr_thread_t *tid, void *baton)
144145
apr_thread_exit(tid, APR_SUCCESS);
145146
return NULL;
146147
}
148+
#endif
147149

148150
/**
149151
* Callback called when the mhServCtx_t pool is destroyed.
@@ -1776,12 +1778,13 @@ void mhConfigServer(mhServCtx_t *serv_ctx, ...)
17761778
*/
17771779
void mhStartServer(mhServCtx_t *ctx)
17781780
{
1779-
apr_thread_t *thread;
17801781
mhError_t err = MOCKHTTP_NO_ERROR;
17811782
apr_status_t status;
17821783

17831784
if (ctx->threading == mhThreadSeparate) {
17841785
#if APR_HAS_THREADS
1786+
apr_thread_t *thread;
1787+
17851788
/* Setup a non-blocking TCP server */
17861789
status = setupTCPServer(ctx);
17871790
if (!status) {
@@ -1806,8 +1809,8 @@ void mhStartServer(mhServCtx_t *ctx)
18061809

18071810
void mhStopServer(mhServCtx_t *ctx)
18081811
{
1812+
#if APR_HAS_THREADS
18091813
apr_status_t status;
1810-
#ifdef APR_HAS_THREADS
18111814
if (ctx->threading == mhThreadSeparate && ctx->threadid) {
18121815
ctx->cancelThread = YES;
18131816
apr_thread_join(&status, ctx->threadid);

0 commit comments

Comments
 (0)