Changeset 101 in Main for trunk/Server/server.c
- Timestamp:
- Sep 19, 2024, 11:45:27 PM (8 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/server.c
r100 r101 750 750 #endif 751 751 752 #if def __MINGW32__752 #if defined(__MINGW32__) || defined(__HAIKU__) 753 753 struct thread_entry { 754 #ifdef __HAIKU__ 755 thread_id thread; 756 #else 754 757 HANDLE handle; 758 #endif 755 759 bool used; 756 760 }; … … 760 764 struct timeval tv; 761 765 int i; 762 #if def __MINGW32__766 #if defined(__MINGW32__) || defined(__HAIKU__) 763 767 struct thread_entry threads[2048]; 764 768 for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) { … … 784 788 break; 785 789 } else if(ret == 0) { 786 #ifdef __MINGW32__787 for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) {788 if(threads[i].used) {789 DWORD ex;790 GetExitCodeThread(threads[i].handle, &ex);791 if(ex != STILL_ACTIVE) {792 CloseHandle(threads[i].handle);793 threads[i].used = false;794 }795 }796 }797 #endif798 790 #ifdef SERVICE 799 791 if(status.dwCurrentState == SERVICE_STOP_PENDING) { … … 837 829 } 838 830 #elif defined(__HAIKU__) 839 thread_id thr = spawn_thread(tw_server_pass, "Tewi HTTPd", 60, e); 840 resume_thread(thr); 831 for(j = 0; j < sizeof(threads) / sizeof(threads[0]); j++) { 832 if(threads[j].used) { 833 thread_info info; 834 bool kill = false; 835 if(get_thread_info(threads[j].thread, &info) == B_OK){ 836 }else{ 837 kill = true; 838 } 839 if(kill){ 840 printf("Kill thread %d\n", threads[j].thread); 841 threads[j].used = false; 842 } 843 } 844 } 845 for(j = 0; j < sizeof(threads) / sizeof(threads[0]); j++) { 846 if(!threads[j].used) { 847 threads[j].thread = spawn_thread(tw_server_pass, "Tewi HTTPd", 60, e); 848 threads[j].used = true; 849 resume_thread(threads[j].thread); 850 break; 851 } 852 } 841 853 #else 842 854 pid_t pid = fork();
Note:
See TracChangeset
for help on using the changeset viewer.