Open sloncho opened 1 month ago
To handle threading issues, I generally get a session handle (PWWrapper.GetCurrentSession2() and PWWrapper.SetCurrentSession2()) to pass between threads.
When going between different datasources, I have nested PWSessions successfully. PWSession was not really designed for the multi-thread case. The session handle may expire if the PWSession you grabbed the handle from goes out of scope. Should be easy to test.
Dave
Get Outlook for iOShttps://aka.ms/o0ukef
From: Sunny Milenov @.> Sent: Friday, October 18, 2024 4:46:40 PM To: DaveBrumbaugh/MostOfDavesClasses-CSharp-Wrappers-For-ProjectWise @.> Cc: Subscribed @.***> Subject: [DaveBrumbaugh/MostOfDavesClasses-CSharp-Wrappers-For-ProjectWise] Question about multi-threading (Issue #4)
First, very nice wrappers, thanks.
The docs do not really specify any helpfull information about how the API (and the wrappers) work in multi-threaded environment.
PWSession is very handy, but it calls aaApi_Initialize and aaApi_Login. So if 2 separate threads in the app create 2 different sessions to 2 different datasources, will consecutive calls to other aaApi datasource-related functions work on the same thread.
- Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_DaveBrumbaugh_MostOfDavesClasses-2DCSharp-2DWrappers-2DFor-2DProjectWise_issues_4&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=sk-ekxUnNMalOQEhaVxEI4V1pV15JYrhm6dJCxmg7kI&m=EWAfFSwZwb0wyit366rCEZFepu6508xJUuRmb0VW-uBT_Xde7bM7FkHMf89kHrnA&s=m_N0W5LinwmqBCy3EKoUFb8s2Lmny6iTR1B9iuTlIS4&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ADG5FLXCEGOUIDDWEH5KZH3Z4FXTBAVCNFSM6AAAAABQGVVW2GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU4TQMZWGA4DONQ&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=sk-ekxUnNMalOQEhaVxEI4V1pV15JYrhm6dJCxmg7kI&m=EWAfFSwZwb0wyit366rCEZFepu6508xJUuRmb0VW-uBT_Xde7bM7FkHMf89kHrnA&s=sWeaIebTaXLHa1kRVY22i9fuOjrMEOh1O_YxISvtiBc&e=. You are receiving this because you are subscribed to this thread.Message ID: @.***>
First, very nice wrappers, thanks.
The docs do not really specify any helpfull information about how the API (and the wrappers) work in multi-threaded environment.
PWSession is very handy, but it calls aaApi_Initialize and aaApi_Login. So if 2 separate threads in the app create 2 different sessions to 2 different datasources, will consecutive calls to other aaApi datasource-related functions work on the same thread.