Results of 1 - 10 of about 49 for wait (0.076 sec.)
- 同期プリミティブ 14111
- 同期プリミティブ ソースコード: Lib/asyncio/locks.py asyncio の同期プリミティブは threading モジュールのそれと類似するようにデザインされていますが、2つの重要な注意事項があります: asyncio の同期プリミティブはスレッドセーフではありません。従っ
...を使ってください); 同期プリミティブのメソッドは timeout 引数を受け付けません; タイムアウトを伴う操作を実行するには asyncio.wait_for() 関数を使ってください。 asyncio モジュールは以下の基本的な同期プリミティブを持っています: Lock Event Condition Semaph...) # ... 後で async with lock : # 共有状態にアクセスする これは以下のコードと等価です: lock = asyncio . Lock () # ... 後で await lock . acquire () try : # 共有状態にアクセスする finally : lock . release () バージョン 3.10 で変更: loop パラメータが削除...フラグを管理します。フラグの値は set() メソッドにより true に、また clear() メソッドにより false に設定することができます。 wait() メソッドはフラグが true になるまで処理をブロックします。フラグの初期値は false です。 バージョン 3.10 で変更: loop パラメ... - https://man.mtool.work/python/3.14/library/asyncio-sync.html
- threading --- スレッドベースの並列処理 11681
- threading --- スレッドベースの並列処理 ソースコード: Lib/threading.py このモジュールでは、高水準のスレッドインターフェースをより低水準 な _thread モジュールの上に構築しています。 利用可能な環境 : not WASI. このモジュールは WebAssembly では動
...ールでは以下の定数も定義しています: threading. TIMEOUT_MAX ブロックする関数 ( Lock.acquire() 、 RLock.acquire() 、 Condition.wait() など) の timeout 引数に指定できる最大値です。 この値を超えるタイムアウトを指定すると OverflowError が送出されます。 Adde...f seconds specified by timeout and as long as the lock cannot be acquired. A timeout argument of -1 specifies an unbounded wait. It is forbidden to specify a timeout when blocking is False . ロックを獲得すると True を、ロックを獲得できなかったとき (例...たロックの対応するメソッドを呼び出します。 他のメソッドは、関連付けられたロックを保持した状態で呼び出さなければなりません。 wait() メソッドはロックを解放します。そして別のスレッドが notify() または notify_all() を呼ぶことによってスレッドを起こすまでブ... - https://man.mtool.work/python/3.14/library/threading.html
- 高水準の API インデックス 10896
- 高水準の API インデックス このページには、async/await に対応する asyncio の高水準 API をすべて列挙しています。 Task asyncio プログラムの実行、タスクの作成、タイムアウト付きで複数の処理の完了を待つためのユーティリティです。 run() イベントルー
...返します。 current_task() 現在のタスクを返します。 all_tasks() イベントループのまだ終了していないすべてのタスクを返します。 await sleep() 指定した秒数だけスリープします。 await gather() 並行してスケジュールして、待ちます。 await wait_for() タイムアウト...で実行します。 await shield() 取り消しから保護します。 await wait() 完了かどうかを監視します。 timeout() タイムアウト付きで実行します。 wait_fo...ted() for ループ向けにコルーチンの完了を監視します。 使用例 asyncio.gather() を使って複数の処理を並列に実行する 。 asyncio.wait_for() を使って強制的にタイムアウトする 。 非同期処理をキャンセルする 。 asyncio.sleep() を使う 。 Tasks のドキュメント も参... - https://man.mtool.work/python/3.14/library/asyncio-api-index.html
- concurrent.futures --- 並列タスク実行 10414
- concurrent.futures --- 並列タスク実行 Added in version 3.2. ソースコード: Lib/concurrent/futures/thread.py 、 Lib/concurrent/futures/process.py および Lib/concurrent/futures/interpreter.py concurrent.futures モジュールは、呼び出し可能オブジ
...バージョン 3.5 で変更: chunksize 引数が追加されました。 バージョン 3.14 で変更: buffersize 引数が追加されました。 shutdown ( wait = True , * , cancel_futures = False ) executor に対して、現在保留中のフューチャーが実行された後で、使用中のすべての資源を解...するように伝えます。シャットダウンにより後に Executor.submit() と Executor.map() を呼び出すと RuntimeError が送出されます。 wait が True の場合、すべての未完了のフューチャの実行が完了して Executor に関連付けられたリソースが解放されるまで、このメソッド...は返りません。 wait が False の場合、このメソッドはすぐに返り、すべての未完了のフューチャの実行が完了したときに、 Executor に関連付けられたリソ... - https://man.mtool.work/python/3.14/library/concurrent.futures.html
- ストリーム 9734
- ストリーム ソースコード: Lib/asyncio/streams.py ストリームはネットワークコネクションと合わせて動作する高水準の async/await 可能な基本要素です。ストリームはコールバックや低水準のプロトコルやトランスポートを使うことなくデータを送受信することを
...ームを使って書いた TCP エコークライアントの例です: import asyncio async def tcp_echo_client ( message ): reader , writer = await asyncio . open_connection ( '127.0.0.1' , 8888 ) print ( f 'Send: { message !r} ' ) writer . write ( message . encode ())...await writer . drain () data = await reader . read ( 100 ) print ( f 'Received: { data . decode () !r} ' ) print ( 'Close the co...nnection' ) writer . close () await writer . wait_closed () asyncio . run ( tcp_echo_client ( 'Hello World!' )) 下記の 使用例 節も参照してください。 ストリーム... - https://man.mtool.work/python/3.14/library/asyncio-stream.html
- GDB による C API 拡張と CPython 内部のデバッグ 9448
- GDB による C API 拡張と CPython 内部のデバッグ このドキュメントでは、Python の GDB 拡張 python-gdb.py を GDB デバッガと組み合わせて、CPython 拡張や CPython インタープリタ自体をデバッグする方法を説明します。 クラッシュやデッドロックなどの低レ
...示します。 thread コマンドを使うと別のスレッドを選択できます。 (gdb) info threads 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sy...sdeps/unix/sysv/linux/x86_64/sem_wait.S:86 * 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82 thread...528) self.__block.acquire() #8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.l... - https://man.mtool.work/python/3.14/howto/gdb_helpers.html
- サブプロセス 8950
- サブプロセス ソースコード: Lib/asyncio/subprocess.py , Lib/asyncio/base_subprocess.py このセクションはサブプロセスの生成と管理を行う高水準の async/await asyncio API について説明します。 以下は、 asyncio モジュールがどのようにシェルコマンドを
...実行し、結果を取得できるかを示す例です: import asyncio async def run ( cmd ): proc = await asyncio . create_subprocess_shell ( cmd , stdout = asyncio . subprocess . PIPE , stderr = asyncio . subprocess . PIPE ) st...dout , stderr = await proc . communicate () print ( f '[ { cmd !r} exited with { proc . returncode } ]' ) if stdout : print ( f '[stdout] \n { s...に実行して監視するのは簡単です。 実際、上の例を変更して複数のコマンドを同時に実行するのはごく簡単です。 async def main (): await asyncio . gather ( run ( 'ls /zzz' ), run ( 'sleep 1; echo "hello"' )) asyncio . run ( main ()) 使用例 節も参照してください... - https://man.mtool.work/python/3.14/library/asyncio-subprocess.html
- コルーチンとタスク 8572
- コルーチンとタスク この節では、コルーチンと Task を利用する高レベルの asyncio の API の概略を解説します。 コルーチン ソースコード: Lib/asyncio/coroutines.py async/await 構文で宣言された コルーチン は、 asyncio を使ったアプリケーションを書く
..." を出力し、そこから 1 秒待って "world" を出力します: >>> import asyncio >>> async def main (): ... print ( 'hello' ) ... await asyncio . sleep ( 1 ) ... print ( 'world' ) >>> asyncio . run ( main ()) hello world 単にコルーチンを呼び出しただけでは、コ...ます: 最上位のエントリーポイントである "main()" 関数を実行する asyncio.run() 関数 (上の例を参照してください。) コルーチンを await すること。次のコード片は 1 秒間待機した後に "hello" と出力し、 更に 2 秒間待機してから "world" と出力します: import asynci...o import time async def say_after ( delay , what ): await asyncio . sleep ( delay ) print ( what ) async def main (): print ( f "started at { time . strftime ( ' %X ' ) } " ) await... - https://man.mtool.work/python/3.14/library/asyncio-task.html
- subprocess --- サブプロセス管理 8074
- subprocess --- サブプロセス管理 ソースコード: Lib/subprocess.py subprocess モジュールでは、新しいプロセスを生成し、その標準入力、標準出力、標準エラー出力のパイプに接続して、終了コードを取得できます。 このモジュールは、次のような古いモジュー
...) 子プロセスが終了しているかどうかを調べます。 returncode 属性を設定して返します。そうでなければ None を返します。 Popen. wait ( timeout = None ) 子プロセスが終了するまで待ちます。 returncode 属性を設定して返します。 プロセスが timeout 秒後に終了して...ない場合、 TimeoutExpired 例外を送出します。この例外を捕捉して wait を再試行するのは安全です。 注釈 stdout=PIPE または stderr=PIPE を使っていると、子プロセスがパイプに大量の出力を生成し、OS...function is implemented using a busy loop (non-blocking call and short sleeps). Use the asyncio module for an asynchronous wait: see asyncio.create_subprocess_exec . バージョン 3.3 で変更: timeout が追加されました Popen. communicate ( input = None ,... - https://man.mtool.work/python/3.14/library/subprocess.html
- 変更履歴 8074
- 変更履歴 次の Python バージョン リリース日: XXXX-XX-XX セキュリティ gh-160499 : Fix unbounded memory growth in asyncio TLS connections when a peer stops reading but keeps sending records that make OpenSSL generate its own replies (such as T
...en the connection is lost, the handshake times out or the call is cancelled during the TLS handshake. asyncio.StreamWriter.wait_closed() no longer waits forever after such a failure. gh-160297 : Fix tarfile.TarFile.extractall() and tarfile.TarFile.ex...hutdown_timeout when the peer has sent EOF but does not read the data still queued for it. Closing such a connection could wait indefinitely; it is now aborted with TimeoutError once the timeout expires. gh-160326 : Raise ValueError for a NaN timeout...in threading.Condition.wait() and the blocking calls built on it, such as threading.Event.wait() , threading.Semaphore.acquire() and queue.Queue.get()... - https://man.mtool.work/python/3.14/whatsnew/changelog.html