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

Enable multithreading, fix #441 #466

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions engine/IO/src/luos_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,9 +902,11 @@ static void Phy_Dispatch(void)
phy_job.phy_data = NULL;

// Write the job in the phy queue and get back the pointer to it
MSGALLOC_MUTEX_LOCK
phy_job_t *job_ptr = Phy_AddJob(&phy_ctx.phy[y], &phy_job);
// Notify this phy that a job is available and give it the concerned job on his queue
phy_ctx.phy[y].job_cb(&phy_ctx.phy[y], job_ptr);
MSGALLOC_MUTEX_UNLOCK
}
}
Phy_SetIrqState(false);
Expand Down
2 changes: 2 additions & 0 deletions engine/core/src/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,10 @@ error_return_t Service_Deliver(phy_job_t *job)
// This means that this job already contain a service filter.
// We just have to loop in the service list, filter it, call the callback and remove it from the service filter.
error_return_t error = SUCCEED;
MSGALLOC_MUTEX_LOCK
LUOS_ASSERT(job);
service_filter_t *service_filter = (service_filter_t *)job->phy_data;
MSGALLOC_MUTEX_UNLOCK
for (int i = 0; i < service_ctx.number; i++)
{
if (((*service_filter) >> i) & 0x01)
Expand Down
8 changes: 4 additions & 4 deletions examples/projects/native/gate_wscom/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ int main(void)
Pipe_Init();
Gate_Init();
// Create a thread to convert messages into Json and steam them using Websocket
// pthread_t thread_id;
// pthread_create(&thread_id, NULL, Gate_Pipe_LoopThread, NULL);
pthread_t thread_id;
pthread_create(&thread_id, NULL, Gate_Pipe_LoopThread, NULL);
while (1)
{
Luos_Loop();
Expand All @@ -65,7 +65,7 @@ int main(void)
#else
Ws_Loop();
#endif
Pipe_Loop();
Gate_Loop();
// Pipe_Loop();
// Gate_Loop();
}
}
Loading