• 互斥对象线程程序必需的工具它们并非万能的。

    Mutexes are necessary tools for threaded programs, but they can't do everything.

    youdao

  • 第一线程锁住互斥数据添加队列中其他线程等待轮到它们操作。

    The first thread locks the mutex and appends data to the queue, while the other threads wait for their turn.

    youdao

  • 如果进行调用的线程并不拥有那个互斥对象,则这个调用可能会失败

    This call might fail if the calling thread does not own the mutex object.

    youdao

  • 现在互斥对象已解锁,其它线程可以访问修改链接列表可能还会添加

    Now that the mutex is unlocked, other threads can access and modify the linked list, possibly adding items.

    youdao

  • 创建使用互斥过程仅仅是开始一个线程的过程要稍微复杂一些

    The procedure for creating and using a mutex is a bit more complicated than the procedure for starting a thread.

    youdao

  • POSIX提供互斥函数创建临界用于实施线程对象内存独占访问

    POSIX provides the mutex function to create critical sections that enforce exclusive access to an object (a piece of memory) by a single thread.

    youdao

  • 如果在读线程能够获得互斥之前发生了超时,那么需要进行处理

    If the timeout has occurred before the reader thread could acquire the mutex, then no processing need be done.

    youdao

  • 如果调用线程并不拥有这个互斥信号量,那么这个函数执行将会失败

    If the calling thread has no ownership of this mutex, this function fails.

    youdao

  • 不只线程访问互斥变量时所有线程必须使用同步否则可能会发生一些非常糟糕事情

    When more than one thread accesses a mutable variable, all threads must use synchronization, or else some very bad things can happen.

    youdao

  • 可以推测到,当线程试图锁定一个未加互斥对象时,POSI x线程同意锁定,不会使线程进入睡眠状态。

    As you may have guessed, the POSIX threads library will grant a lock without having put the thread to sleep at all if a thread tries to lock an unlocked mutex.

    youdao

  • 线程正在其它事情的时候(由于互斥对象当前锁定的),如果希望锁定互斥对象,这个调用相当方便。

    This call is handy when you want to lock a mutex while your thread is doing something else (because the mutex is currently locked).

    youdao

  • 如果另一个线程锁定那个互斥,则pthread _ mutex _ trylock不会阻塞

    If another thread locks the mutex, the pthread_mutex_trylock will not block.

    youdao

  • 允许原子地(atomically)解除互斥锁定,等待条件变量不会有干涉其他线程可能

    It also allows you to unlock the mutex and wait on the condition variable atomically, without the possible intervention of another thread.

    youdao

  • 互斥一起使用时,pthreads条件变量可以在线程之间提供基于事件同步机制,不过同步的。

    When used along with the Mutex, pthreads conditional variables provide event-based synchronization between threads, but they are synchronous.

    youdao

  • 之后创建一个新的线程同时增量threadcount;在完成之后,它解锁互斥量。

    After locking that, it creates a new thread and increments threadcount; after it's done, it unlocks the mutex.

    youdao

  • 锁定互斥对象线程调用 pthread_cond_wait(&mycond,&mymutex)。

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

    youdao

  • 一旦 pthread_cond_wait()锁定互斥对象,那么返回允许1 号线程继续执行

    Once pthread_cond_wait() has the lock, it will then return and allow thread 1 to continue execution.

    youdao

  • 现在线程需要使用两个互斥量。

    Now, imagine that two threads want to use them. Thread one does this.

    youdao

  • 第一线程互斥锁,发现队列的,然后 _cond 上阻塞自身,这会式地释放互斥锁。

    The first reader thread locked the mutex, realized that the queue is empty, and blocked itself on _cond, which implicitly released the mutex.

    youdao

  • 这么会唤醒所有等待条件变量_ cond线程;读线程现在隐式地争夺互斥

    Doing so awakens all the reader threads that were waiting on the condition variable _cond; the reader threads now implicitly compete for the mutex lock as and when it is released.

    youdao

  • 临界操作坚持互斥锁(mutual exclusion)原则(当一个线程处于临界中时,其他所有线程不能进入临界段)。

    Critical sections operate on the principle of mutual exclusion (when a thread is within a critical section, all other threads are excluded from entering).

    youdao

  • 如果能够做到一点,线程代码非常高效的,并且不会占用宝贵的互斥对象

    If you can do this, your threaded code will be really efficient and it won't tie up valuable mutex locks.

    youdao

  • 两个函数调用作用就是警告其它线程它们继续睡眠等待轮到它们对互斥对象加锁

    The calls act as a warning to other threads to go to sleep and wait their turn for the mutex lock.

    youdao

  • 两个线程不能同时对同一个互斥对象加锁

    No two threads can have the same mutex locked at the same time.

    youdao

  • 同时还要快速互斥对象解锁以便其它线程能够进行任何必需的更改

    At the same time it will also quickly unlock the mutex so that others can make any necessary changes.

    youdao

  • 对于等待同一互斥其他线程不利影响因为等待时间现在更长

    For other threads waiting on the same mutex, this has a negative effect, because the wait time is now even longer.

    youdao

  • 操作系统调度程序决定哪个线程获得互斥控制权—通常,等待时间最长线读取数据

    The operating system scheduler determines which thread gets control of the mutex next-typically, the reader thread that has waited the longest gets to read the data first.

    youdao

  • 因为添加取出数据操作使用相同互斥,所以读取数据速度会影响数据的线程访问

    Because you're sharing the same mutex for push and pop operations, the data-read speed is somewhat compromised as writer threads access the lock.

    youdao

  • 如果超时时间段结束时还没有唤醒线程需要唤醒自身释放互斥锁。

    If not awake otherwise, at the end of the timeout, the reader needs to wake itself up and release the mutex.

    youdao

  • 可能因为分配时间片结束持有互斥线程取消调度。

    A thread holding a mutex can be de-scheduled, perhaps because it was the end of its time-slice.

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定