Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C/C++ - Thread
Forum - C/C++ - Thread

Avatar
Thejuster (Admin)
Guru^2


Messaggi: 2302
Iscritto: 04/05/2008

Segnala al moderatore
Postato alle 17:13
Sabato, 25/04/2015
Scusate cosa c'e che non va?
Non riesco a far avviare il thread




Codice sorgente



remoteSocket = accept(listenSocket, (struct sockaddr *) &Client_addr, &sin_size);

recv(remoteSocket, buffer, sizeof(buffer), 0);

pthread_t thread;

pthread_create(&thread, NULL, run_thread, (void *), remoteSocket);

pthread_join(thread,NULL);



void *run_thread(void *ptr)
{

cout << "test" << endl;

}

[\code]



https://mire.forumfree.it/ - Mire Engine
C# UI Designer
PM Quote
Avatar
TheDarkJuster (Member)
Guru^2


Messaggi: 1620
Iscritto: 27/09/2013

Segnala al moderatore
Postato alle 17:32
Sabato, 25/04/2015
Perchè non usi la classe thread del C++11 ? http://www.cplusplus.com/reference/thread/thread/ ? Comunque l'errore è
pthread_create(&thread, NULL, &run_thread, (void *), remoteSocket);

PM Quote