我需要同时运行两个独立的进程。一个是在端口X上进行侦听,并在接收到数据时发送数据,另一个正在做其他一些事情。运行两个线程[c]
香港专业教育学院尝试这样: pthread_t thread1, thread2;
int iret1, iret2;
iret1 = pthread_create(&thread1, NULL, getAddress(), NULL);
iret2 = pthread_create(&thread2, NULL, operate(), (struct IPlist) *IPlist);
在第一个我想运行get(Address)
- 听力和发送部分,在第二个我需要用一个参数运行operate()
:*IP list //(struct IPlist *IPlist)
但是,它显示错误:
warning: passing argument 3 of ‘pthread_create’ makes pointer from integer without a cast
/usr/include/pthread.h:225: note: expected ‘void * (*)(void *)’ but argument is of type int
error: incompatible type for argument 4 of ‘pthread_create’
/usr/include/pthread.h:225: note: expected ‘void * __restrict__’ but argument is of type ‘struct IPlist’
这里有什么问题?
我不太了解手册,所以我在这里问。
感谢您的任何帮助!
你在问什么?上面的文字没有问题。 – littleadv
@Shaggy你能告诉我们你想达到什么吗? – Allwyn
问题补充 – shaggy