From a3a2e6413bf845ba0f0a25ee5f8df9c3418c8704 Mon Sep 17 00:00:00 2001 From: Hua Meng <161220092@smail.nju.edu.cn> Date: Thu, 2 Aug 2018 23:39:26 +0800 Subject: [PATCH] msvcp90: Add implementation of _Concurrent_vector_Internal_push_back. Signed-off-by: Hua Meng <161220092@smail.nju.edu.cn> Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcp90/misc.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index 8fe5294d06b..58e546cdf3e 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -2216,10 +2216,24 @@ MSVCP_size_t __thiscall _Concurrent_vector_base_v4__Internal_grow_to_at_least_wi /* ?_Internal_push_back@_Concurrent_vector_base_v4@details@Concurrency@@IEAAPEAX_KAEA_K@Z */ DEFINE_THISCALL_WRAPPER(_Concurrent_vector_base_v4__Internal_push_back, 12) void * __thiscall _Concurrent_vector_base_v4__Internal_push_back( - _Concurrent_vector_base_v4 *this, MSVCP_size_t len1, MSVCP_size_t *len2) + _Concurrent_vector_base_v4 *this, MSVCP_size_t element_size, MSVCP_size_t *idx) { - FIXME("(%p %ld %p) stub\n", this, len1, len2); - return NULL; + MSVCP_size_t index, seg, segment_base; + void *data; + + TRACE("(%p %ld %p)\n", this, element_size, idx); + + do { + index = this->early_size; + _Concurrent_vector_base_v4__Internal_reserve(this, index + 1, + element_size, MSVCP_SIZE_T_MAX / element_size); + } while(InterlockedCompareExchangeSizeT(&this->early_size, index + 1, index) != index); + seg = _vector_base_v4__Segment_index_of(index); + segment_base = (seg == 0) ? 0 : (1 << seg); + data = (BYTE*)this->segment[seg] + element_size * (index - segment_base); + *idx = index; + + return data; } /* ?_Internal_resize@_Concurrent_vector_base_v4@details@Concurrency@@IAEXIIIP6AXPAXI@ZP6AX0PBXI@Z2@Z */