Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sock loop wakeup #1591

Merged
merged 24 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ce91d8f
Skeleton of test thread
huitema Apr 8, 2022
4be6b65
More tests
huitema Apr 9, 2022
c7b93ef
Merge branch 'master' into sock-loop-wakeup
huitema Apr 10, 2022
e2f20b9
Windows version of threads works.
huitema Apr 14, 2022
df8bc8e
Async restart is windows only.
huitema Apr 17, 2022
e75c497
Merge branch 'master' into sock-loop-wakeup
huitema Apr 30, 2022
bd94393
Merge branch 'master' into sock-loop-wakeup
huitema May 6, 2022
e61dcd5
Merge branch 'master' into sock-loop-wakeup
huitema May 19, 2022
a04c475
Merge branch 'master' into sock-loop-wakeup
huitema May 19, 2022
f0c43e3
Merge branch 'master' into sock-loop-wakeup
huitema Jun 6, 2022
232b072
Merge branch 'master' into sock-loop-wakeup
huitema Aug 16, 2022
40b03e0
Merge branch 'master' into sock-loop-wakeup
huitema Oct 21, 2022
9bc8843
Merge branch 'master' into sock-loop-wakeup
huitema Nov 29, 2022
6f54376
Merge branch 'master' into sock-loop-wakeup
huitema Dec 12, 2022
5308efa
Merge branch 'master' into sock-loop-wakeup
huitema Dec 12, 2022
36d3606
Update to latest master
huitema Dec 6, 2023
ad46b93
Thread wake up trials
huitema Dec 6, 2023
24e476d
Fix windows 32 bit builds
huitema Dec 6, 2023
12474fc
fix unused variable warning
huitema Dec 7, 2023
b3190e5
Fix thread tester on Mac.
Dec 7, 2023
094dc38
Merge remote-tracking branch 'refs/remotes/origin/sock-loop-wakeup' i…
Dec 7, 2023
dd27fa0
Fix network load thread
Dec 7, 2023
c915a76
Merge branch 'master' into sock-loop-wakeup
huitema Dec 8, 2023
c090338
Merge branch 'master' into sock-loop-wakeup
huitema Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,13 @@ if(BUILD_TESTING AND picoquic_BUILD_TESTS)
COMMAND picoquic_ct -S ${PROJECT_SOURCE_DIR} -n -r)
add_test(NAME picohttp_ct
COMMAND picohttp_ct -S ${PROJECT_SOURCE_DIR} -n -r)

add_executable(thread_test
thread_tester/thread_test.c)
target_link_libraries(thread_test PRIVATE picoquic-log picoquic-core)
target_include_directories(thread_test PRIVATE loglib picoquic)
set_picoquic_compile_settings(thread_test)

endif()

# get all project files for formatting
Expand Down
15 changes: 15 additions & 0 deletions picoquic.sln
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PerfAndStressTest", "PerfAn
{998765EE-64DF-49C1-8471-A79E2DA7CD21} = {998765EE-64DF-49C1-8471-A79E2DA7CD21}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thread_tester", "thread_tester\thread_tester.vcxproj", "{57341DB3-B498-4E7B-9CB2-E897A562C15F}"
ProjectSection(ProjectDependencies) = postProject
{B3DDD196-3D03-4396-97BD-E5DE733E9D24} = {B3DDD196-3D03-4396-97BD-E5DE733E9D24}
{63E1E6B7-DB5F-4EDC-8AC8-7E9F5990D11F} = {63E1E6B7-DB5F-4EDC-8AC8-7E9F5990D11F}
{998765EE-64DF-49C1-8471-A79E2DA7CD21} = {998765EE-64DF-49C1-8471-A79E2DA7CD21}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baton_app", "baton_app\baton_app.vcxproj", "{C0F21D3F-ECC3-4AB5-A3E3-E2D48965EBA5}"
ProjectSection(ProjectDependencies) = postProject
{C8F3740E-56FB-4BE7-9D8C-30A954846146} = {C8F3740E-56FB-4BE7-9D8C-30A954846146}
Expand Down Expand Up @@ -184,6 +191,14 @@ Global
{436B580F-B0E8-4EB8-A987-08218D863316}.Release|x64.Build.0 = Release|x64
{436B580F-B0E8-4EB8-A987-08218D863316}.Release|x86.ActiveCfg = Release|Win32
{436B580F-B0E8-4EB8-A987-08218D863316}.Release|x86.Build.0 = Release|Win32
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Debug|x64.ActiveCfg = Debug|x64
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Debug|x64.Build.0 = Debug|x64
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Debug|x86.ActiveCfg = Debug|Win32
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Debug|x86.Build.0 = Debug|Win32
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Release|x64.ActiveCfg = Release|x64
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Release|x64.Build.0 = Release|x64
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Release|x86.ActiveCfg = Release|Win32
{57341DB3-B498-4E7B-9CB2-E897A562C15F}.Release|x86.Build.0 = Release|Win32
{C0F21D3F-ECC3-4AB5-A3E3-E2D48965EBA5}.Debug|x64.ActiveCfg = Debug|x64
{C0F21D3F-ECC3-4AB5-A3E3-E2D48965EBA5}.Debug|x64.Build.0 = Debug|x64
{C0F21D3F-ECC3-4AB5-A3E3-E2D48965EBA5}.Debug|x86.ActiveCfg = Debug|Win32
Expand Down
1 change: 1 addition & 0 deletions picoquic/picoquic_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ typedef struct st_picoquic_event_t {
#endif

int picoquic_create_thread(picoquic_thread_t* thread, picoquic_thread_fn thread_fn, void* arg);
int picoquic_wait_thread(picoquic_thread_t thread);
void picoquic_delete_thread(picoquic_thread_t* thread);

int picoquic_create_mutex(picoquic_mutex_t* mutex);
Expand Down
14 changes: 14 additions & 0 deletions picoquic/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,19 @@ int picoquic_create_thread(picoquic_thread_t * thread, picoquic_thread_fn thread
return ret;
}

int picoquic_wait_thread(picoquic_thread_t thread)
{
int ret = 0;
#ifdef _WINDOWS
if (WaitForSingleObject(thread, INFINITE) == WAIT_TIMEOUT) {
ret = -1;
}
#else
ret = pthread_join(thread, NULL);
#endif
return ret;
}

void picoquic_delete_thread(picoquic_thread_t * thread)
{
#ifdef _WINDOWS
Expand All @@ -1033,6 +1046,7 @@ void picoquic_delete_thread(picoquic_thread_t * thread)
#endif
}


int picoquic_create_mutex(picoquic_mutex_t * mutex)
{
#ifdef _WINDOWS
Expand Down
Loading
Loading