Oleg <[email protected]> wrote:
> My program process multiple NFQUEUEs by creating a separate thread
> for every NFQUEUE. An each thread do recv() and nfq_set_verdict2():
[..]
> main()
> {
> ...
> for(i = 0; i < q_cnt; i++) {
> ret = pthread_create(&(thread_data[i].id), NULL, thread_start,
> &thread_data[i].nfq_num);
> if (ret != 0) {
> fprintf(stderr, "thread creation error: %s", strerror(ret));
> exit(EXIT_FAILURE);
> }
> }
> ...
> }
>
> static void*
> thread_start(void *data)
> {
> struct nfq_handle *h;
> int fd, n;
> static char *pkt_buf;
static? Looks buggy...
> Since every thread do nfq_open(), has a separate descriptor and etc, i think
> i don't need a lock around recv() and nfq_set_verdict2(). Am i right?
Yes, as long as all threads have their own receive buffer this
won't need locks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html