-
Notifications
You must be signed in to change notification settings - Fork 849
Add new API TSContScheduleOnEntirePool and TSContScheduleEveryOnEntirePool #10742
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
Merged
duke8253
merged 1 commit into
apache:master
from
duke8253:master-schedule_on_entire_pool
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
doc/developer-guide/api/functions/TSContScheduleEveryOnEntirePool.en.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| .. Licensed to the Apache Software Foundation (ASF) under one or more | ||
| contributor license agreements. See the NOTICE file distributed | ||
| with this work for additional information regarding copyright | ||
| ownership. The ASF licenses this file to you under the Apache | ||
| License, Version 2.0 (the "License"); you may not use this file | ||
| except in compliance with the License. You may obtain a copy of | ||
| the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
| implied. See the License for the specific language governing | ||
| permissions and limitations under the License. | ||
|
|
||
| .. include:: ../../../common.defs | ||
|
|
||
| .. default-domain:: c | ||
|
|
||
| TSContScheduleEveryOnEntirePool | ||
| ******************************* | ||
|
|
||
| Synopsis | ||
| ======== | ||
|
|
||
| .. code-block:: cpp | ||
|
|
||
| #include <ts/ts.h> | ||
|
|
||
| .. function:: std::vector<TSAction> TSContScheduleEveryOnEntirePool(TSCont contp, TSHRTime every, TSThreadPool tp) | ||
|
|
||
| Description | ||
| =========== | ||
|
|
||
| Schedules :arg:`contp` to run :arg:`every` milliseconds, on all threads that | ||
| belongs to :arg:`tp`. The :arg:`every` is an approximation, meaning it will be at least | ||
| :arg:`every` milliseconds but possibly more. Resolutions finer than roughly 5 milliseconds will | ||
| not be effective. Note that :arg:`contp` is required to NOT have a mutex, since the continuation | ||
| is scheduled on multiple threads. This means the continuation must handle synchronization itself. | ||
|
|
||
| The return value can be used to cancel the scheduled event via :func:`TSActionCancel`. This | ||
| is effective until the continuation :arg:`contp` is being dispatched. However, if it is | ||
| scheduled on another thread this can be problematic to be correctly timed. The return value | ||
| can be checked with :func:`TSActionDone` to see if the continuation ran before the return. | ||
|
|
||
| .. note:: Due to scheduling multiple events, the return value is changed to :type:`std::vector<TSAction>`, as compared to :type:`TSAction` of the other `TSContSchedule` APIs. | ||
|
|
||
| Note that the `TSContSchedule` family of API shall only be called from an ATS EThread. | ||
| Calling it from raw non-EThreads can result in unpredictable behavior. | ||
|
|
||
| See Also | ||
| ======== | ||
|
|
||
| :doc:`TSContScheduleOnPool.en` | ||
| :doc:`TSContScheduleOnThread.en` | ||
| :doc:`TSContScheduleOnEntirePool.en` | ||
| :doc:`TSContScheduleEveryOnPool.en` | ||
| :doc:`TSContScheduleEveryOnThread.en` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
doc/developer-guide/api/functions/TSContScheduleEveryOnThread.en.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| .. Licensed to the Apache Software Foundation (ASF) under one or more | ||
| contributor license agreements. See the NOTICE file distributed | ||
| with this work for additional information regarding copyright | ||
| ownership. The ASF licenses this file to you under the Apache | ||
| License, Version 2.0 (the "License"); you may not use this file | ||
| except in compliance with the License. You may obtain a copy of | ||
| the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
| implied. See the License for the specific language governing | ||
| permissions and limitations under the License. | ||
|
|
||
| .. include:: ../../../common.defs | ||
|
|
||
| .. default-domain:: c | ||
|
|
||
| TSContScheduleEveryOnThread | ||
| *************************** | ||
|
|
||
| Synopsis | ||
| ======== | ||
|
|
||
| .. code-block:: cpp | ||
|
|
||
| #include <ts/ts.h> | ||
|
|
||
| .. function:: TSAction TSContScheduleEveryOnThread(TSCont contp, TSHRTime every, TSEventThread ethread) | ||
|
|
||
| Description | ||
| =========== | ||
|
|
||
| Schedules :arg:`contp` to run :arg:`every` milliseconds, on the thread specified by | ||
| :arg:`ethread`. The :arg:`every` is an approximation, meaning it will be at least :arg:`every` | ||
| milliseconds but possibly more. Resolutions finer than roughly 5 milliseconds will not be | ||
| effective. Note that :arg:`contp` is required to have a mutex, which is provided to | ||
| :func:`TSContCreate`. | ||
|
|
||
| The return value can be used to cancel the scheduled event via :func:`TSActionCancel`. This | ||
| is effective until the continuation :arg:`contp` is being dispatched. However, if it is | ||
| scheduled on another thread this can be problematic to be correctly timed. The return value | ||
| can be checked with :func:`TSActionDone` to see if the continuation ran before the return. | ||
|
|
||
| If :arg:`contp` has no thread affinity set, the thread it is now scheduled on will be set | ||
| as its thread affinity thread. | ||
|
|
||
| Note that the `TSContSchedule` family of API shall only be called from an ATS EThread. | ||
| Calling it from raw non-EThreads can result in unpredictable behavior. | ||
|
|
||
| See Also | ||
| ======== | ||
|
|
||
| :doc:`TSContScheduleOnPool.en` | ||
| :doc:`TSContScheduleOnThread.en` | ||
| :doc:`TSContScheduleOnEntirePool.en` | ||
| :doc:`TSContScheduleEveryOnPool.en` | ||
| :doc:`TSContScheduleEveryOnEntirePool.en` |
60 changes: 60 additions & 0 deletions
60
doc/developer-guide/api/functions/TSContScheduleOnEntirePool.en.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| .. Licensed to the Apache Software Foundation (ASF) under one or more | ||
| contributor license agreements. See the NOTICE file distributed | ||
| with this work for additional information regarding copyright | ||
| ownership. The ASF licenses this file to you under the Apache | ||
| License, Version 2.0 (the "License"); you may not use this file | ||
| except in compliance with the License. You may obtain a copy of | ||
| the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
| implied. See the License for the specific language governing | ||
| permissions and limitations under the License. | ||
|
|
||
| .. include:: ../../../common.defs | ||
|
|
||
| .. default-domain:: c | ||
|
|
||
| TSContScheduleOnEntirePool | ||
| ************************** | ||
|
|
||
| Synopsis | ||
| ======== | ||
|
|
||
| .. code-block:: cpp | ||
|
|
||
| #include <ts/ts.h> | ||
|
|
||
| .. function:: std::vector<TSAction> TSContScheduleOnEntirePool(TSCont contp, TSHRTime timeout, TSThreadPool tp) | ||
|
|
||
| Description | ||
| =========== | ||
|
|
||
| Schedules :arg:`contp` to run :arg:`timeout` milliseconds in the future, on all threads that | ||
| belongs to :arg:`tp`. The :arg:`timeout` is an approximation, meaning it will be at least | ||
| :arg:`timeout` milliseconds but possibly more. Resolutions finer than roughly 5 milliseconds will | ||
| not be effective. Note that :arg:`contp` is required to NOT have a mutex, since the continuation | ||
| is scheduled on multiple threads. This means the continuation must handle synchronization itself. | ||
|
|
||
| The return value can be used to cancel the scheduled event via :func:`TSActionCancel`. This | ||
| is effective until the continuation :arg:`contp` is being dispatched. However, if it is | ||
| scheduled on another thread this can be problematic to be correctly timed. The return value | ||
| can be checked with :func:`TSActionDone` to see if the continuation ran before the return, | ||
| which is possible if :arg:`timeout` is `0`. | ||
|
|
||
| .. note:: Due to scheduling multiple events, the return value is changed to :type:`std::vector<TSAction>`, as compared to :type:`TSAction` of the other `TSContSchedule` APIs. | ||
|
|
||
| Note that the `TSContSchedule` family of API shall only be called from an ATS EThread. | ||
| Calling it from raw non-EThreads can result in unpredictable behavior. | ||
|
|
||
| See Also | ||
| ======== | ||
|
|
||
| :doc:`TSContScheduleOnPool.en` | ||
| :doc:`TSContScheduleOnThread.en` | ||
| :doc:`TSContScheduleEveryOnPool.en` | ||
| :doc:`TSContScheduleEveryOnThread.en` | ||
| :doc:`TSContScheduleEveryOnEntirePool.en` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout seems wrong name here. It's a delay, right ? I got confused here because the "every" version also uses both timeout and delay "randomly"?
Are these API prototypes the same as what was sent to the mailing list? If not, maybe an update there as well ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just following the naming convention for the other
TSContScheduleAPIs. I'll update the email in the mailing list to show the changes of this PR.The timeout is kind of like a delay, but it could also be a negative number for negative queue events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we got rid of the negative queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure it's still here?
trafficserver/src/iocore/eventsystem/UnixEThread.cc
Line 241 in 0d14262