condition.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1998-2001, 2004, 2006, 2007, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: condition.c,v 1.23 2007/06/18 23:47:49 tbox Exp $ */
#include <config.h>
#include <isc/condition.h>
#include <isc/assertions.h>
#define LSIGNAL 0
#define LBROADCAST 1
HANDLE h;
/*
* This handle is shared across all threads
*/
if (h == NULL) {
/* XXX */
return (ISC_R_UNEXPECTED);
}
/*
* The threadlist will hold the actual events needed
* for the wait condition
*/
return (ISC_R_SUCCESS);
}
/*
* Add the thread to the threadlist along with the required events
*/
static isc_result_t
{
return (ISC_R_NOMEMORY);
/*
* Create the thread-specific handle
*/
return (ISC_R_UNEXPECTED);
}
/*
* Add the thread ID and handles to list of threads for broadcast
*/
/*
* The thread is holding the manager lock so this is safe
*/
return (ISC_R_SUCCESS);
}
static isc_result_t
{
/*
* Look for the thread ID.
*/
threadcond != NULL;
return (ISC_R_SUCCESS);
}
}
/*
* Not found, so add it.
*/
}
/*
* Unlike pthreads, the caller MUST hold the lock associated with
* the condition variable when calling us.
*/
/* XXX */
return (ISC_R_UNEXPECTED);
}
return (ISC_R_SUCCESS);
}
/*
* Unlike pthreads, the caller MUST hold the lock associated with
* the condition variable when calling us.
*/
/*
* Notify every thread registered for this
*/
threadcond != NULL;
}
if (failed)
return (ISC_R_UNEXPECTED);
return (ISC_R_SUCCESS);
}
/*
* Delete the threadlist
*/
while (threadcond != NULL) {
threadcond = next;
}
return (ISC_R_SUCCESS);
}
/*
* This is always called when the mutex (lock) is held, but because
* we are waiting we need to release it and reacquire it as soon as the wait
* is over. This allows other threads to make use of the object guarded
* by the mutex but it should never try to delete it as long as the
* number of waiters > 0. Always reacquire the mutex regardless of the
* result of the wait. Note that EnterCriticalSection will wait to acquire
* the mutex.
*/
static isc_result_t
/*
* Get the thread events needed for the wait
*/
if (tresult != ISC_R_SUCCESS)
return (tresult);
if (result == WAIT_FAILED) {
/* XXX */
return (ISC_R_UNEXPECTED);
}
if (result == WAIT_TIMEOUT)
return (ISC_R_TIMEDOUT);
return (ISC_R_SUCCESS);
}
}
isc_time_t *t) {
/* XXX */
return (ISC_R_UNEXPECTED);
}
milliseconds = 0xFFFFFFFF;
else
}