nmux: seems to work now
This commit is contained in:
parent
ac392f4ead
commit
dd51b9cc04
1 changed files with 3 additions and 0 deletions
3
nmux.cpp
3
nmux.cpp
|
@ -231,7 +231,9 @@ int main(int argc, char* argv[])
|
||||||
if(NMUX_DEBUG) fprintf(stderr, "mainfor: gwbing...");
|
if(NMUX_DEBUG) fprintf(stderr, "mainfor: gwbing...");
|
||||||
current_write_buffer = (unsigned char*)pool->get_write_buffer();
|
current_write_buffer = (unsigned char*)pool->get_write_buffer();
|
||||||
if(NMUX_DEBUG) fprintf(stderr, "gwbed.\nmainfor: cond broadcasting...");
|
if(NMUX_DEBUG) fprintf(stderr, "gwbed.\nmainfor: cond broadcasting...");
|
||||||
|
pthread_mutex_lock(&wait_mutex);
|
||||||
pthread_cond_broadcast(&wait_condition);
|
pthread_cond_broadcast(&wait_condition);
|
||||||
|
pthread_mutex_unlock(&wait_mutex);
|
||||||
if(NMUX_DEBUG) fprintf(stderr, "cond broadcasted.\n");
|
if(NMUX_DEBUG) fprintf(stderr, "cond broadcasted.\n");
|
||||||
//Shouldn't we do it after we put data in?
|
//Shouldn't we do it after we put data in?
|
||||||
// No, on get_write_buffer() actually the previous buffer is getting available
|
// No, on get_write_buffer() actually the previous buffer is getting available
|
||||||
|
@ -304,6 +306,7 @@ void* client_thread (void* param)
|
||||||
pthread_mutex_lock(&wait_mutex);
|
pthread_mutex_lock(&wait_mutex);
|
||||||
this_client->sleeping = 1;
|
this_client->sleeping = 1;
|
||||||
pthread_cond_wait(&wait_condition, &wait_mutex);
|
pthread_cond_wait(&wait_condition, &wait_mutex);
|
||||||
|
pthread_mutex_unlock(&wait_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Wait for the socket to be available for write.
|
//Wait for the socket to be available for write.
|
||||||
|
|
Loading…
Reference in a new issue