aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-09-26 00:55:24 -0400
committersotech117 <michael_foiani@brown.edu>2023-09-26 00:55:24 -0400
commit0720962e7459e6469e72a0ed6cf4159e4f0b2b86 (patch)
tree9e3d19bd8ad2a04a0711717ef1e6c61b0bed9033
parent250c7b721e4be987b5ff090de096dbb2c61ecf6c (diff)
find two bugs with passing arguments into threads
-rw-r--r--server.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/server.c b/server.c
index af1551e..d717eca 100644
--- a/server.c
+++ b/server.c
@@ -386,7 +386,7 @@ int read_file(int fd, char buffer[FILE_READ_SIZE], int station_num) {
if (bytes_read == 0) {
// printf("end of file, restarting\n");
pthread_t send_announce_thread;
- pthread_create(&send_announce_thread, NULL, send_announce_routine, (void *) &station_num);
+ pthread_create(&send_announce_thread, NULL, send_announce_routine, station_num);
if (lseek(fd, 0, SEEK_SET) == -1)
{
@@ -912,7 +912,7 @@ void update_user_station(int tcpfd, int stationNum) {
*/
void *send_announce_routine(void *arg) {
// unpack arg
- int station_num = * (int *) arg;
+ int station_num = (int) arg;
// send the announce messages
for (int i = 0; i < max_active_users; i++)
{