Skip to content
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
6 changes: 3 additions & 3 deletions doc/.tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,9 @@ file_filter = locale/<lang>/LC_MESSAGES/developer-guide/api/functions/TSContMute
source_file = _build/locale/pot/developer-guide/api/functions/TSContMutexGet.en.pot
source_lang = en

[apache-traffic-server-6x.developer-guide--api--functions--TSContSchedule_en]
file_filter = locale/<lang>/LC_MESSAGES/developer-guide/api/functions/TSContSchedule.en.po
source_file = _build/locale/pot/developer-guide/api/functions/TSContSchedule.en.pot
[apache-traffic-server-6x.developer-guide--api--functions--TSContScheduleOnPool_en]
file_filter = locale/<lang>/LC_MESSAGES/developer-guide/api/functions/TSContScheduleOnPool.en.po
source_file = _build/locale/pot/developer-guide/api/functions/TSContScheduleOnPool.en.pot
source_lang = en

[apache-traffic-server-6x.developer-guide--api--functions--TSDebug_en]
Expand Down
58 changes: 0 additions & 58 deletions doc/developer-guide/api/functions/TSContScheduleEvery.en.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

.. default-domain:: c

TSContSchedule
**************
TSContScheduleEveryOnPool
*************************

Synopsis
========
Expand All @@ -28,31 +28,31 @@ Synopsis

#include <ts/ts.h>

.. function:: TSAction TSContSchedule(TSCont contp, TSHRTime timeout)
.. function:: TSAction TSContScheduleEveryOnPool(TSCont contp, TSHRTime every)

Description
===========

Schedules :arg:`contp` to run :arg:`delay` milliseconds in the future. This is approximate. The delay
will be at least :arg:`delay` but possibly more. Resolutions finer than roughly 5 milliseconds will
not be effective. :arg:`contp` is required to have a mutex, which is provided to
Schedules :arg:`contp` to run :arg:`every` milliseconds, on a random thread 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 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, which is possible if
:arg:`timeout` is `0`. Returns ``nullptr`` if thread affinity was cleared.
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`.

TSContSchedule() or TSContScheduleEvery() will default to set the thread affinity to the calling thread
when no affinity is already set for example, using :func:`TSContThreadAffinitySet`
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:`TSContScheduleEvery.en`
:doc:`TSContScheduleOnPool.en`
:doc:`TSContScheduleOnThread.en`
25 changes: 19 additions & 6 deletions doc/developer-guide/api/functions/TSContScheduleOnPool.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ Synopsis
Description
===========

Mostly the same as :func:`TSContSchedule`. Schedules :arg:`contp` on a random thread that belongs to :arg:`tp`.
If thread type of the thread specified by thread affinity is the same as :arg:`tp`, the :arg:`contp` will
be scheduled on the thread specified by thread affinity.
Schedules :arg:`contp` to run :arg:`timeout` milliseconds in the future, on a random thread 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 have a mutex, which is provided to
:func:`TSContCreate`.

The continuation is scheduled for a particular thread selected from a group of similar threads, as indicated by :arg:`tp`.
The continuation is scheduled for a particular thread selected from a group of similar threads,
as indicated by :arg:`tp`. If :arg:`contp` already has an thread affinity set, and the thread
type of thread affinity is the same as :arg:`tp`, then :arg:`contp` will be scheduled on the
thread specified by thread affinity.

=========================== =======================================================================================
Pool Properties
Expand All @@ -54,6 +59,15 @@ called and continuations that use them have the same restrictions. ``TS_THREAD_P
are threads that exist to perform long or blocking actions, although sufficiently long operation can
impact system performance by blocking other continuations on the threads.

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`.

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.

Expand Down Expand Up @@ -124,6 +138,5 @@ the same continuation on two different threads of the same type.
See Also
========

:doc:`TSContSchedule.en`
:doc:`TSContScheduleEvery.en`
:doc:`TSContScheduleEveryOnPool.en`
:doc:`TSContScheduleOnThread.en`
17 changes: 14 additions & 3 deletions doc/developer-guide/api/functions/TSContScheduleOnThread.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,25 @@ Synopsis
Description
===========

Mostly the same as :func:`TSContSchedule`. Schedules :arg:`contp` on :arg:`ethread`.
Schedules :arg:`contp` to run :arg:`timeout` milliseconds in the future, on the thread specified by
:arg:`ethread`. 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 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, which is possible if
:arg:`timeout` is `0`.

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:`TSContSchedule.en`
:doc:`TSContScheduleEvery.en`
:doc:`TSContScheduleOnPool.en`
:doc:`TSContScheduleEveryOnPool.en`
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Description
===========

Set the thread affinity of continuation :arg:`contp` to :arg:`ethread`. Future calls to
:func:`TSContSchedule`, and :func:`TSContScheduleOnPool` that has the same type as :arg:`ethread`
:func:`TSContScheduleOnPool`, and :func:`TSContScheduleOnPool` that has the same type as :arg:`ethread`
will schedule the continuation on :arg:`ethread`, rather than an arbitrary thread of that type.

:func:`TSContSchedule` and :func:``TSContScheduleEvery` will default the affinity to calling thread
:func:`TSContScheduleOnPool` and :func:`TSContScheduleEveryOnPool` will default the affinity to calling thread
when invoked without explicitly setting the thread affinity.

Return Values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Activating Continuations
************************

Continuations are activated when they receive an event or by
``TSContSchedule`` (which schedules a continuation to receive an event).
``TSContScheduleOnPool`` (which schedules a continuation to receive an event).
Continuations might receive an event because:

- Your plugin calls ``TSContCall``
Expand Down
2 changes: 1 addition & 1 deletion doc/developer-guide/plugins/continuations/index.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ one of the following:
transactions uses ``TSContDataSet/Get``

- uses ``TSCacheXXX``, ``TSNetXXX``, ``TSHostLookup``, or
``TSContSchedule`` APIs
``TSContScheduleOnPool`` APIs

Before being activated, a caller must grab the continuation's mutex.
This requirement makes it possible for a continuation's handler function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Event Event Sender
:data:`TS_EVENT_CACHE_LOOKUP_COMPLETE` :data:`TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK` :type:`TSHttpTxn`
:data:`TS_EVENT_IMMEDIATE` :func:`TSVConnClose`
:func:`TSVIOReenable`
:func:`TSContSchedule`
:func:`TSContScheduleOnPool`
:func:`TSContScheduleOnThread`
:data:`TS_EVENT_IMMEDIATE` :data:`TS_HTTP_REQUEST_TRANSFORM_HOOK`
Expand All @@ -113,8 +112,7 @@ Event Event Sender
:func:`TSHttpTxnServerIntercept`
:func:`TSHttpTxnIntercept`
:data:`TS_EVENT_HOST_LOOKUP` :func:`TSHostLookup` :type:`TSHostLookupResult`
:data:`TS_EVENT_TIMEOUT` :func:`TSContSchedule`
:func:`TSContScheduleOnPool`
:data:`TS_EVENT_TIMEOUT` :func:`TSContScheduleOnPool`
:func:`TSContScheduleOnThread`
:data:`TS_EVENT_ERROR`
:data:`TS_EVENT_VCONN_READ_READY` :func:`TSVConnRead` :type:`TSVIO`
Expand All @@ -137,6 +135,5 @@ The continuation functions are listed below:
- :func:`TSContDataSet`
- :func:`TSContDestroy`
- :func:`TSContMutexGet`
- :func:`TSContSchedule`
- :func:`TSContScheduleOnPool`
- :func:`TSContScheduleOnThread`
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.1.1\n"

#: ../../developer-guide/api/functions/TSContSchedule.en.rst:32
#: ../../developer-guide/api/functions/TSContScheduleOnPool.en.rst:32
msgid "Description"
msgstr "解説"

#: ../../developer-guide/api/functions/TSContSchedule.en.rst:25
#: ../../developer-guide/api/functions/TSContScheduleOnPool.en.rst:25
msgid "Synopsis"
msgstr "概要"

#: ../../developer-guide/api/functions/TSContSchedule.en.rst:22
msgid "TSContSchedule"
#: ../../developer-guide/api/functions/TSContScheduleOnPool.en.rst:22
msgid "TSContScheduleOnPool"
msgstr ""

#: ../../developer-guide/api/functions/TSContSchedule.en.rst:27
#: ../../developer-guide/api/functions/TSContScheduleOnPool.en.rst:27
msgid "`#include <ts/ts.h>`"
msgstr "`#include <ts/ts.h>`"
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ msgstr ""
#: ../../developer-guide/plugins/continuations/activating-continuations.en.rst:25
msgid ""
"Continuations are activated when they receive an event or by "
"``TSContSchedule`` (which schedules a continuation to receive an event). "
"``TSContScheduleOnPool`` (which schedules a continuation to receive an event). "
"Continuations might receive an event because:"
msgstr ""
"継続は、イベントを受け取った際か ``TSContSchedule`` (イベントを受け取るため"
"継続は、イベントを受け取った際か ``TSContScheduleOnPool`` (イベントを受け取るため"
"継続をスケジュールする関数)によってアクティベートされます。下記の理由により"
"継続がイベントを受け取る可能性があります。 :"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ msgstr ""

#: ../../developer-guide/plugins/continuations/index.en.rst:56
msgid ""
"uses ``TSCacheXXX``, ``TSNetXXX``, ``TSHostLookup``, or ``TSContSchedule`` "
"uses ``TSCacheXXX``, ``TSNetXXX``, ``TSHostLookup``, or ``TSContScheduleOnPool`` "
"APIs"
msgstr ""
"``TSCacheXXX``, ``TSNetXXX``, ``TSHostLookup``, もしくは ``TSContSchedule`` "
"``TSCacheXXX``, ``TSNetXXX``, ``TSHostLookup``, もしくは ``TSContScheduleOnPool`` "
"API を使用する。"
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ msgid ":data:`TS_EVENT_IMMEDIATE`"
msgstr ":data:`TS_EVENT_IMMEDIATE`"

#: ../../../developer-guide/plugins/continuations/writing-handler-functions.en.rst:90
msgid ":func:`TSVConnClose` :func:`TSVIOReenable` :func:`TSContSchedule`"
msgstr ":func:`TSVConnClose` :func:`TSVIOReenable` :func:`TSContSchedule`"
msgid ":func:`TSVConnClose` :func:`TSVIOReenable` :func:`TSContScheduleOnPool`"
msgstr ":func:`TSVConnClose` :func:`TSVIOReenable` :func:`TSContScheduleOnPool`"

#: ../../../developer-guide/plugins/continuations/writing-handler-functions.en.rst:93
msgid ":data:`TS_HTTP_REQUEST_TRANSFORM_HOOK`"
Expand Down Expand Up @@ -329,8 +329,8 @@ msgstr ":data:`TS_EVENT_TIMEOUT`"

#: ../../../developer-guide/plugins/continuations/writing-handler-functions.en.rst:108
#: ../../../developer-guide/plugins/continuations/writing-handler-functions.en.rst:130
msgid ":func:`TSContSchedule`"
msgstr ":func:`TSContSchedule`"
msgid ":func:`TSContScheduleOnPool`"
msgstr ":func:`TSContScheduleOnPool`"

#: ../../../developer-guide/plugins/continuations/writing-handler-functions.en.rst:109
msgid ":data:`TS_EVENT_ERROR`"
Expand Down
2 changes: 0 additions & 2 deletions include/ts/ts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1193,10 +1193,8 @@ tsapi TSCont TSContCreate(TSEventFunc funcp, TSMutex mutexp);
tsapi void TSContDestroy(TSCont contp);
tsapi void TSContDataSet(TSCont contp, void *data);
tsapi void *TSContDataGet(TSCont contp);
tsapi TSAction TSContSchedule(TSCont contp, TSHRTime timeout);
tsapi TSAction TSContScheduleOnPool(TSCont contp, TSHRTime timeout, TSThreadPool tp);
tsapi TSAction TSContScheduleOnThread(TSCont contp, TSHRTime timeout, TSEventThread ethread);
tsapi TSAction TSContScheduleEvery(TSCont contp, TSHRTime every /* millisecs */);
tsapi TSAction TSContScheduleEveryOnPool(TSCont contp, TSHRTime every /* millisecs */, TSThreadPool tp);
tsapi TSAction TSContScheduleEveryOnThread(TSCont contp, TSHRTime every /* millisecs */, TSEventThread ethread);
tsapi TSReturnCode TSContThreadAffinitySet(TSCont contp, TSEventThread ethread);
Expand Down
Loading