Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mongoose
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ganil-acq
GANILinux
linux-service
library
mongoose
Commits
104c4fab
Commit
104c4fab
authored
3 years ago
by
Sergey Lyubka
Browse files
Options
Downloads
Patches
Plain Diff
More docs
parent
fd5eb2d3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/README.md
+14
-2
14 additions, 2 deletions
docs/README.md
with
14 additions
and
2 deletions
docs/README.md
+
14
−
2
View file @
104c4fab
...
@@ -530,8 +530,20 @@ void mg_mgr_wakeup(struct mg_connection *pipe);
...
@@ -530,8 +530,20 @@ void mg_mgr_wakeup(struct mg_connection *pipe);
```
```
Create a "pipe" connection which is safe to pass to a different task/thread,
Create a "pipe" connection which is safe to pass to a different task/thread,
and which is used to wake up event manager from a different task. These two
and which is used to wake up event manager from a different task. These
functions are designed to implement multi-threaded support, to handle
functions are designed to implement multi-threaded support, to handle two
common use cases:
-
There are multiple consumer connections, e.g. connected websocket clients.
A server constantly pushes some data to all of them. In this case, a data
producer task should call
`mg_mgr_wakeup()`
as soon as more data is produced.
A pipe's event handler should push data to all client connection.
Use
`c->label`
to mark client connections.
-
In order to serve a request, a long blocking operation should be performed.
In this case, request handler assignes some marker to
`c->label`
and then
spawns a handler task and gives a pipe to a
handler task. A handler does its job, and when data is ready, wakes up a
manager. A pipe's event handler pushes data to a marked connection.
Another task can wake up a sleeping event manager (in
`mg_mgr_poll()`
call)
Another task can wake up a sleeping event manager (in
`mg_mgr_poll()`
call)
using
`mg_mgr_wakeup()`
. When an event manager is woken up, a pipe
using
`mg_mgr_wakeup()`
. When an event manager is woken up, a pipe
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment