Skip to content

Commit

Permalink
remove _Mtx/Cnd_init/destroy from <xthreads.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
achabense committed Aug 17, 2023
1 parent a5d7849 commit 1a4e1f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
8 changes: 0 additions & 8 deletions stl/inc/xthreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ enum { // mutex types
_Mtx_recursive = 0x100
};

#ifdef _CRTBLD
_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int);
_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t);
#endif // _CRTBLD
_CRTIMP2_PURE void __cdecl _Mtx_init_in_situ(_Mtx_t, int);
_CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t);
_CRTIMP2_PURE int __cdecl _Mtx_current_owns(_Mtx_t);
Expand All @@ -117,10 +113,6 @@ void __cdecl _Smtx_unlock_exclusive(_Smtx_t*);
void __cdecl _Smtx_unlock_shared(_Smtx_t*);

// condition variables
#ifdef _CRTBLD
_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*);
_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t);
#endif // _CRTBLD
_CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(_Cnd_t);
_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t);
_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_wait(_Cnd_t, _Mtx_t); // TRANSITION, ABI: Always succeeds
Expand Down
2 changes: 2 additions & 0 deletions stl/src/cond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ _CRTIMP2_PURE void __cdecl _Cnd_init_in_situ(const _Cnd_t cond) { // initialize

_CRTIMP2_PURE void __cdecl _Cnd_destroy_in_situ(_Cnd_t) {} // destroy condition variable in situ

// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility
_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initialize
*pcond = nullptr;

Expand All @@ -41,6 +42,7 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t* const pcond) { // initializ
return _Thrd_result::_Success;
}

// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility
_CRTIMP2_PURE void __cdecl _Cnd_destroy(const _Cnd_t cond) { // clean up
if (cond) { // something to do, do it
_Cnd_destroy_in_situ(cond);
Expand Down
6 changes: 6 additions & 0 deletions stl/src/cthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ _CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency() { // return numb
return info.dwNumberOfProcessors;
}

// TRANSITION, ABI: these functions are used only by _Thrd_create()
_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t*, int);
_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t);
_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*);
_CRTIMP2_PURE void __cdecl _Cnd_destroy(_Cnd_t);

// TRANSITION, ABI: _Thrd_create() is preserved for binary compatibility
_CRTIMP2_PURE _Thrd_result __cdecl _Thrd_create(_Thrd_t* thr, _Thrd_start_t func, void* d) { // create thread
_Thrd_result res;
Expand Down
2 changes: 2 additions & 0 deletions stl/src/mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ _CRTIMP2_PURE void __cdecl _Mtx_destroy_in_situ(_Mtx_t mtx) { // destroy mutex i
(void) mtx;
}

// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility
_CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initialize mutex
*mtx = nullptr;

Expand All @@ -65,6 +66,7 @@ _CRTIMP2_PURE _Thrd_result __cdecl _Mtx_init(_Mtx_t* mtx, int type) { // initial
return _Thrd_result::_Success;
}

// TRANSITION, ABI: used only by _Thrd_create(), which is preserved for binary compatibility
_CRTIMP2_PURE void __cdecl _Mtx_destroy(_Mtx_t mtx) { // destroy mutex
if (mtx) { // something to do, do it
_Mtx_destroy_in_situ(mtx);
Expand Down

0 comments on commit 1a4e1f2

Please sign in to comment.