From c8bf38e5fb717d40635a2a89b22ed71b0de4266b Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 1 Dec 2020 13:33:34 +0100 Subject: Squashed 'dependencies/uthash/' content from commit 8e67ced git-subtree-dir: dependencies/uthash git-subtree-split: 8e67ced1d1c5bd8141c542a22630e6de78aa6b90 --- tests/sleep_test.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/sleep_test.c (limited to 'tests/sleep_test.c') diff --git a/tests/sleep_test.c b/tests/sleep_test.c new file mode 100644 index 000000000..60e60d1b6 --- /dev/null +++ b/tests/sleep_test.c @@ -0,0 +1,32 @@ +#include "uthash.h" +#include /* malloc */ +#include /* printf */ +#include /* getpid */ + +typedef struct example_user_t { + int id; + int cookie; + UT_hash_handle hh; +} example_user_t; + +int main() +{ + int i; + example_user_t *user, *users=NULL; + + /* create elements */ + for(i=0; i<10000; i++) { + if ( (user = (example_user_t*)malloc(sizeof(example_user_t))) == NULL) { + exit(-1); + } + user->id = i; + user->cookie = i*i; + HASH_ADD_INT(users,id,user); + } + + printf("pid: %u\n", (unsigned)getpid()); + /* printf("sig: %p\n", &users->hh.tbl->signature); */ + /* printf("bbv: %p\n", &users->hh.tbl->bloom_bv); */ + sleep(60*10); + return 0; +} -- cgit v1.2.3