diff options
| author | Wez Furlong <wez@php.net> | 2004-07-31 17:27:03 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2004-07-31 17:27:03 +0000 |
| commit | d4ad4ac3703cb2ee9e8b5166981bce4767cdc8cd (patch) | |
| tree | 229ffe2e14c08fdd826c1c391b52f49d9aa0bcef /ext/com_dotnet/com_persist.c | |
| parent | d0be02990893df2a778d3a772bf230cf3348dcdb (diff) | |
| download | php-git-d4ad4ac3703cb2ee9e8b5166981bce4767cdc8cd.tar.gz | |
Allow COM to build under non-zts.
Thanks Frank.
Diffstat (limited to 'ext/com_dotnet/com_persist.c')
| -rwxr-xr-x | ext/com_dotnet/com_persist.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index d9ba2aa350..70f3d89ad1 100755 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -38,7 +38,7 @@ typedef struct { CONST_VTBL struct IStreamVtbl *lpVtbl; - THREAD_T engine_thread; + DWORD engine_thread; LONG refcount; php_stream *stream; int id; @@ -53,17 +53,23 @@ static void istream_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) istream_destructor(stm); } +#ifdef ZTS +# define TSRMLS_FIXED() TSRMLS_FETCH(); +#else +# define TSRMLS_FIXED() +#endif + #define FETCH_STM() \ + TSRMLS_FIXED() \ php_istream *stm = (php_istream*)This; \ - if (tsrm_thread_id() != stm->engine_thread) \ - return E_UNEXPECTED; + if (GetCurrentThreadId() != stm->engine_thread) \ + return RPC_E_WRONG_THREAD; static HRESULT STDMETHODCALLTYPE stm_queryinterface( IStream *This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject) { - TSRMLS_FETCH(); FETCH_STM(); if (IsEqualGUID(&IID_IUnknown, riid) || @@ -79,7 +85,6 @@ static HRESULT STDMETHODCALLTYPE stm_queryinterface( static ULONG STDMETHODCALLTYPE stm_addref(IStream *This) { - TSRMLS_FETCH(); FETCH_STM(); return InterlockedIncrement(&stm->refcount); @@ -88,7 +93,6 @@ static ULONG STDMETHODCALLTYPE stm_addref(IStream *This) static ULONG STDMETHODCALLTYPE stm_release(IStream *This) { ULONG ret; - TSRMLS_FETCH(); FETCH_STM(); ret = InterlockedDecrement(&stm->refcount); @@ -103,7 +107,6 @@ static ULONG STDMETHODCALLTYPE stm_release(IStream *This) static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULONG *pcbRead) { int nread; - TSRMLS_FETCH(); FETCH_STM(); nread = php_stream_read(stm->stream, pv, cb); @@ -120,7 +123,6 @@ static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULO static HRESULT STDMETHODCALLTYPE stm_write(IStream *This, void const *pv, ULONG cb, ULONG *pcbWritten) { int nwrote; - TSRMLS_FETCH(); FETCH_STM(); nwrote = php_stream_write(stm->stream, pv, cb); @@ -140,7 +142,6 @@ static HRESULT STDMETHODCALLTYPE stm_seek(IStream *This, LARGE_INTEGER dlibMove, off_t offset; int whence; int ret; - TSRMLS_FETCH(); FETCH_STM(); switch (dwOrigin) { @@ -169,7 +170,6 @@ static HRESULT STDMETHODCALLTYPE stm_seek(IStream *This, LARGE_INTEGER dlibMove, static HRESULT STDMETHODCALLTYPE stm_set_size(IStream *This, ULARGE_INTEGER libNewSize) { - TSRMLS_FETCH(); FETCH_STM(); if (libNewSize.HighPart) { @@ -190,7 +190,6 @@ static HRESULT STDMETHODCALLTYPE stm_set_size(IStream *This, ULARGE_INTEGER libN static HRESULT STDMETHODCALLTYPE stm_copy_to(IStream *This, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { - TSRMLS_FETCH(); FETCH_STM(); return E_NOTIMPL; @@ -198,7 +197,6 @@ static HRESULT STDMETHODCALLTYPE stm_copy_to(IStream *This, IStream *pstm, ULARG static HRESULT STDMETHODCALLTYPE stm_commit(IStream *This, DWORD grfCommitFlags) { - TSRMLS_FETCH(); FETCH_STM(); php_stream_flush(stm->stream); @@ -281,7 +279,7 @@ PHPAPI IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC) return NULL; memset(stm, 0, sizeof(*stm)); - stm->engine_thread = tsrm_thread_id(); + stm->engine_thread = GetCurrentThreadId(); stm->lpVtbl = &php_istream_vtbl; stm->refcount = 1; stm->stream = stream; |
