diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-09-26 00:55:24 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-09-26 00:55:24 -0400 |
commit | 0720962e7459e6469e72a0ed6cf4159e4f0b2b86 (patch) | |
tree | 9e3d19bd8ad2a04a0711717ef1e6c61b0bed9033 | |
parent | 250c7b721e4be987b5ff090de096dbb2c61ecf6c (diff) |
find two bugs with passing arguments into threads
-rw-r--r-- | server.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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++) { |