[Click] how to link use timer or pthread in my element?

竺昱 zhuyudtc at gmail.com
Thu May 14 09:36:24 EDT 2009


Hi all:

  I use click on a project. I want to make each entry in a routing
table change periodly.  and now I have some problems:

1. I implenment a class for for entry in routing table and put a Timer
in the class. I expect it can update the infomation in the entry
periodly. so I made this class to be a element class (classname:
public element) to match Timer(Element*), but this is not a element
processes packets. I do not know if there is any problem. And there is
a runtime errors says that:
    click: ../lib/timer.cc:167: void Timer::schedule_at(const
Timestamp&): Assertion `_router && initialized()' failed.

2. then i want to try multi-thread to do the schedule job. I and the
line "ELEMENT_LIBS(-lpthread)" at the end of .cc file. But it still
reports:
/home/sirs/Desktop/click-1.6.0/userlevel/../elements/local/smaoutentry.cc:88:
undefined reference to `pthread_create'
smaoutentry.o: In function `SMAOutEntry::init_trigger(IP6Address,
IP6Address, IP6Address, bool, Seed, String, String, int, int)':
/home/sirs/Desktop/click-1.6.0/userlevel/../elements/local/smaoutentry.cc:59:
undefined reference to `pthread_create'
I do not know how to do with this problem..


ps. i am still puzzled with how to use the click handler
for example i have a handler "add" in element "table"
so what should i do with /proc/click/table/add? should I just write
all the arguments into the file?

could someone help me to make the entry update itself peroidly? Thanks.


More information about the click mailing list