国产高清精品免费区-男女一进一出抽搐免费视频-中日韩一二三级黄色永久视频-日韩精品人妻一区二区免费视频-日本久久视频在线观看-99热这里只有精品88热-亚洲韩国黄色最新短视频一区-日韩伦理在线观看免费全集-国产av一区二区三区天堂

pthread

pthread

 英

  • 網(wǎng)絡(luò)線程示例;條件變量主要操作;線程模型

例句

I further tested this simple Pthread code on the PPE to see how it scales with an increasing number of threads.

PPE進(jìn)一步測(cè)試這個(gè)簡(jiǎn)單Pthread代碼,了解隨著線程數(shù)量增加性能變化情況

As you can see, pthread_mutex_init accepts a pointer to an already-allocated region of memory to initialize as a mutex.

正如,pthread_mutex_init接受一個(gè)指針作為參數(shù)初始化為互斥對(duì)象,指針指向一塊分配內(nèi)存區(qū)

In other words, the system allocates at least 10MB of private storage for each pthread.

換言之,系統(tǒng)每個(gè)pthread分配至少10MB專用存儲(chǔ)。

This sounds a bit confusing, but the pthread example below will clarify how condition variables work.

聽起來有點(diǎn)難以理解,下面pthread例子會(huì)說明條件變量怎么工作

Thus, PTHREAD_PROCESS_SHARED and interprocess POSIX synchronization primitives can be implemented and are now available.

這樣,PTHREAD_PROCESS_SHARED進(jìn)程間POSIX同步原語可以實(shí)現(xiàn),而且現(xiàn)在可用

pthread -qthreaded or _r invocation mode Creates programs running in a multithreaded environment.

pthread-qthreaded_r調(diào)用模式創(chuàng)建多線程環(huán)境運(yùn)行程序

In Linux, pthread_cond_signal wakes up a thread waiting on a conditional variable.

Linux,pthread_cond_signal會(huì)喚醒等待某個(gè)條件變更某個(gè)線程。

Futex (fast user space mutex) is done by the kernel on the thread ID upon pthread_join (for more on futex, please see Resources).

當(dāng)pthread_join發(fā)生時(shí)內(nèi)核根據(jù)線程ID完成Futexfastuserspacemutex)。(了解futex更多信息,請(qǐng)參閱參考資料)。

POSIX provides locking and synchronization support through the pthread_mutex data type.

POSIX通過pthread_mutex數(shù)據(jù)類型提供鎖定同步支持。

In Linux, the pthread_cancel method terminates execution of the thread identified by the specified threadId.

Linux,pthread_cancel可以終止具體threadId標(biāo)識(shí)線程執(zhí)行。

Note that you've invoked pthread_cond_broadcast after releasing the mutex.

注意釋放互斥之后調(diào)用pthread_cond_broadcast。

If the list were originally empty, you call pthread_cond_broadcast to post push data into the list.

如果列表原來調(diào)用pthread_cond_broadcast宣告列表已經(jīng)添加數(shù)據(jù)。

In libspe2, the operation is synchronous, so if you want to run a thread in the background, you have to make your own pthread calls.

libspe2,這個(gè)操作變成同步,因此可能會(huì)希望后臺(tái)運(yùn)行個(gè)線程發(fā)出自己pthread調(diào)用。

A POSIX API for creating a pthread_mutex lets the mutex implement the priority-inheritance protocol.

用于創(chuàng)建pthread_mutexPOSIXAPI使用互斥實(shí)現(xiàn)優(yōu)先級(jí)繼承協(xié)議。

If you need to block the calling thread for a specific time, then use the pthread_cond_timewait to block the thread.

如果需要指定一段時(shí)間內(nèi)阻塞發(fā)出調(diào)用線程,那么請(qǐng)使用pthread_cond_timewait阻塞。

pthread_mutexes can be created with different locking policies.

pthread_mutex可以使用不同鎖定策略創(chuàng)建

pthread_rwlock_rdlock may fail if the maximum number of read locks (implementation defined) for the lock has been exceeded.

如果超過最大數(shù)量實(shí)現(xiàn)定義),pthread_rwlock_rdlock可能會(huì)失敗

This careful Pthread scheduling leads to much more deterministic and repeatable test runs.

這種仔細(xì)Pthread調(diào)度方法使測(cè)試運(yùn)行結(jié)果更加準(zhǔn)確,可重復(fù)。

Table 1 above displays the pthread condition variable for synchronization between threads.

前面1用于線程同步pthread條件變量。

You can further optimize this situation by using pthread_mutex_timedlock API, if your system supports it (see Resources).

如果系統(tǒng)支持的話,可以使用pthread_mutex_timedlockAPI進(jìn)一步優(yōu)化這個(gè)場(chǎng)景參考資料)。

Instead of providing an abstraction of logical SPUs, this interface is thread-oriented and behaves in a similar way to the pthread library.

這個(gè)接口并不是提供一個(gè)邏輯SPU抽象,而是面向線程,工作方式pthread類似。

The linker complained of some missing pthreads-related exports.

鏈接器抱怨缺少pthread相關(guān)輸出。

Otherwise, it can be created statically when it is declared by a pthread_mutex_t variable.

或者當(dāng)通過pthread_mutex_t變量聲明時(shí)候,可以靜態(tài)地創(chuàng)建。

Meanwhile, you can use pthread_xxxx calls at any time after the thread has been created.

同時(shí)創(chuàng)建線程之后任意時(shí)候可以使用pthread_xxxx。

Linux pthread mutexes are supported by fast user-space mutexes, known as futexes.

快速用戶空間互斥稱為futexes支持Linuxpthread互斥。

Immediately after unlocking the mutex, thread 2 calls the function pthread_cond_broadcast(&mycond).

對(duì)互斥對(duì)象之后,2號(hào)線會(huì)立即調(diào)用函數(shù)pthread_cond_broadcast(&mycond)。

With this background, let's look at the function pthread_cond_timedwait, which you use for the second check.

這些背景知識(shí)我們來看看pthread_cond_timedwait函數(shù),這個(gè)函數(shù)用于進(jìn)行第二個(gè)檢查。

While still holding the mutex lock, our thread will call pthread_cond_wait(&mycond, &mymutex).

鎖定互斥對(duì)象時(shí)線程調(diào)用pthread_cond_wait(&mycond,&mymutex)。

Take care to invoke pthread_rwlock_unlock n times if there are n concurrent read locks for the lock.

如果n個(gè)并發(fā),一定調(diào)用pthread_rwlock_unlockn。

The POSIX lock type is a pthread_mutex.

POSIX類型pthread_mutex。

If the reader thread is awakened before the timeout, the return value from pthread_cond_timedwait will be 0.

如果超時(shí)之前線程喚醒,pthread_cond_timedwait返回0。

As a second argument, it can also accept an optional pthread_mutexattr_t pointer.

第二個(gè)參數(shù),可以接受一個(gè)pthread_mutexattr_t指針。

A note on Pthreads scheduling and compiler optimization

關(guān)于Pthread調(diào)度編譯優(yōu)化點(diǎn)說明