-lpthread

This commit is contained in:
c9s 2014-05-24 12:34:55 +08:00
parent 2a25cfdf01
commit f746030d3f
4 changed files with 13 additions and 8 deletions

View file

@ -4,7 +4,7 @@ libr3_la_SOURCES = node.c edge.c str.c token.c zmalloc.c workers.c queue.c
# libr3_la_LDFLAGS = -export-symbols-regex '^r3_|^match_' # libr3_la_LDFLAGS = -export-symbols-regex '^r3_|^match_'
libr3_la_LIBADD=$(DEPS_LIBS) libr3_la_LIBADD=$(DEPS_LIBS)
AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include -Wall -std=c99 AM_CFLAGS=$(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include -Wall -std=c99 -lpthread
if USE_JEMALLOC if USE_JEMALLOC
AM_CFLAGS += -ljemalloc AM_CFLAGS += -ljemalloc

View file

@ -101,13 +101,12 @@ void r3_tree_feedback(node *tree, node *end) {
edge * e = end->parent_edge; edge * e = end->parent_edge;
node * p = e->parent; node * p = e->parent;
while( p && e ) { while( p && e ) {
e->score += 0.1; e->score += 0.01;
if (e->score > 10) {
if (e->score > 100) {
for (int i = 0 ; i < p->edge_len ; i++ ) { for (int i = 0 ; i < p->edge_len ; i++ ) {
if ( p->edges[i]->score > 0 ) { if ( p->edges[i]->score > 0 ) {
p->edges[i]->score /= 100.0; p->edges[i]->score /= 10.0;
} }
} }
} }

View file

@ -6,7 +6,7 @@
# endif # endif
TESTS = check_tree TESTS = check_tree
AM_CFLAGS = -ggdb $(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@ AM_CFLAGS = -ggdb $(DEPS_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include @CHECK_CFLAGS@
AM_LDFLAGS = $(DEPS_LIBS) -L$(top_builddir)/src -lr3 @CHECK_LIBS@ AM_LDFLAGS = $(DEPS_LIBS) -L$(top_builddir)/src -lpthread -lr3 @CHECK_LIBS@
noinst_HEADERS = \ noinst_HEADERS = \

View file

@ -18,6 +18,7 @@ START_TEST (test_feedback_worker)
{ {
node * n = r3_tree_create(1); node * n = r3_tree_create(1);
r3_tree_insert_path(n, "/foo/bar/baz", NULL); r3_tree_insert_path(n, "/foo/bar/baz", NULL);
r3_tree_insert_path(n, "/foo/bar/qux", NULL); r3_tree_insert_path(n, "/foo/bar/qux", NULL);
r3_tree_insert_path(n, "/foo/bar/quux", NULL); r3_tree_insert_path(n, "/foo/bar/quux", NULL);
@ -27,8 +28,13 @@ START_TEST (test_feedback_worker)
r3_tree_insert_path(n, "/garply/grault/bar", NULL); r3_tree_insert_path(n, "/garply/grault/bar", NULL);
r3_tree_compile(n); r3_tree_compile(n);
node *matched; giant_lock *tl = r3_giant_lock_create(n);
matched = r3_tree_matchl(n, "/garply/grault/foo", strlen("/garply/grault/foo"), NULL);
node * matched;
matched = r3_tree_matchl_ts(n, "/garply/grault/foo", strlen("/garply/grault/foo"), NULL); // thread-safe
r3_feedback_worker_init();
/* /*
feedback_payload payload; feedback_payload payload;