Merge branch '46-just-use-clang-format-to-reformat-sources' into 'master'
Reformat source code with clang-format Closes #46 See merge request isc-projects/bind9!2156 (cherry picked from commit7099e79a9b)4c3b063eImport Linux kernel .clang-format with small modificationsf50b1e06Use clang-format to reformat the source files11341c76Update the definition files for Windowsdf6c1f76Remove tkey_test (which is no-op anyway)
This commit is contained in:
@@ -14,22 +14,23 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/print.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/rwlock.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define sleep(x) Sleep(1000 * x)
|
||||
#define sleep(x) Sleep(1000 * x)
|
||||
#endif
|
||||
|
||||
isc_rwlock_t lock;
|
||||
|
||||
static isc_threadresult_t
|
||||
#ifdef WIN32
|
||||
WINAPI
|
||||
WINAPI
|
||||
#endif
|
||||
run1(void *arg) {
|
||||
run1(void *arg)
|
||||
{
|
||||
char *message = arg;
|
||||
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) ==
|
||||
@@ -38,29 +39,30 @@ run1(void *arg) {
|
||||
sleep(1);
|
||||
printf("%s giving up READ lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got READ lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up READ lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got WRITE lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up WRITE lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
ISC_R_SUCCESS);
|
||||
return ((isc_threadresult_t)0);
|
||||
}
|
||||
|
||||
static isc_threadresult_t
|
||||
#ifdef WIN32
|
||||
WINAPI
|
||||
WINAPI
|
||||
#endif
|
||||
run2(void *arg) {
|
||||
run2(void *arg)
|
||||
{
|
||||
char *message = arg;
|
||||
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) ==
|
||||
@@ -69,31 +71,32 @@ run2(void *arg) {
|
||||
sleep(1);
|
||||
printf("%s giving up WRITE lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got WRITE lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up WRITE lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) ==
|
||||
ISC_R_SUCCESS);
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
printf("%s got READ lock\n", message);
|
||||
sleep(1);
|
||||
printf("%s giving up READ lock\n", message);
|
||||
RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) ==
|
||||
ISC_R_SUCCESS);
|
||||
ISC_R_SUCCESS);
|
||||
return ((isc_threadresult_t)0);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
unsigned int nworkers;
|
||||
unsigned int i;
|
||||
isc_thread_t workers[100];
|
||||
char name[100];
|
||||
void *dupname;
|
||||
char name[100];
|
||||
void * dupname;
|
||||
|
||||
if (argc > 1)
|
||||
nworkers = atoi(argv[1]);
|
||||
|
||||
Reference in New Issue
Block a user