multithreading - how to call "join()" method of one thread in another function in C++? -
i created 2 thread in main function.and call "join()" method on 1 of thread in another.
how call ??
i running "connect" , "sender" 2 threads.now call "join()" method on "connect" thread inside "void clientsocket::sender()" method.
is possible call??
these code snippets ran 2 threads.
int clientsocket::connect() { isconnected = connect(clientsock, (lpsockaddr)&serverinfo,sizeof(serverinfo)); return isconnected; } void clientsocket::sender() { if (isconnected == 0) { send(clientsock, readbuffer.str().c_str(), strlen((char *)readbuffer.str().c_str()), 0); } }
define thread handlers outside of functions, i.e define them global. available anywhere , can call join
method of both in other functions.
Comments
Post a Comment