Skip to content

Commit b29e2a0

Browse files
committed
New version 2016.01.04-rc2
1 parent b5a284e commit b29e2a0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/packages/rtl-threads.fdoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,11 +1460,13 @@ class PTHREAD_EXTERN bound_queue_t :public world_stop_notifier_t {
14601460
size_t bound;
14611461
void notify_world_stop() override;
14621462
void wait();
1463+
void wait_no_world_stop_check(); // used by async system
14631464
public:
14641465
void *lame_opaque; // has to be public for the scanner to find it
14651466
bound_queue_t(thread_control_base_t *tc_, size_t);
14661467
~bound_queue_t();
14671468
void enqueue(void*);
1469+
void enqueue_no_world_stop_check(void*); // used by async system
14681470
void* dequeue();
14691471
void* maybe_dequeue();
14701472
void resize(size_t);
@@ -1524,6 +1526,11 @@ void bound_queue_t::wait() {
15241526
//fprintf(stderr, "possible size change in queue detected %p\n", this);
15251527
}
15261528

1529+
void bound_queue_t::wait_no_world_stop_check() {
1530+
size_changed.wait_for(member_lock, ::std::chrono::duration<int>(1)); // 1second
1531+
}
1532+
1533+
15271534
// get the number of element in the queue
15281535
// (NOT the bound!)
15291536
size_t bound_queue_t::len() {
@@ -1545,6 +1552,16 @@ bound_queue_t::enqueue(void* elt)
15451552
size_changed.notify_all(); // cannot return an error
15461553
}
15471554

1555+
void
1556+
bound_queue_t::enqueue_no_world_stop_check(void* elt)
1557+
{
1558+
::std::unique_lock< ::std::mutex> l(member_lock);
1559+
while(ELTQ->size() >= bound) wait_no_world_stop_check(); // guard against spurious wakeups!
1560+
ELTQ->push_back(elt);
1561+
size_changed.notify_all(); // cannot return an error
1562+
}
1563+
1564+
15481565
void*
15491566
bound_queue_t::dequeue()
15501567
{

0 commit comments

Comments
 (0)