Hi Asam, On Sun, 19 Jul 2020 at 21:38, ASAM <vmax28575@gmail.com> wrote:
Hello Ben,
I quickly made a dummy DLL to limit the problem to the essentials.
Great idea. A more generic example is attractive for people to examine and help out. I browsed the code but I'm sorry it needs a deeper expertise than I have. Hopefully someone working on the threaded FFI will tune in. In the meantime, it won't solve your query but you may find this interesting to watch... Strategies for Non-Blocking FFI https://www.youtube.com/watch?v=L_QFwsNOMAc cheers -ben
I think my problem comes more from how I use the semaphore.
I wanted to do that:
only "semaphore signal", But that somehow doesn't work. Now i'm doing that "[ Processor yield. semaphore signal ] fork" (it work's) but i don't know if that's a good idea.
ffiCallback ^ FFICallback signature: #( void #( uint32 foo ) ) block: [ :foo | Transcript show: 'API Funktion value: ' , foo asString, ' activePriority:', Processor activePriority asString; cr.
"that's working" [ Processor yield. semaphore signal ] fork.
"that usually works 80%." "[ semaphore signal ] fork"
"that crashes pharo almost always." "semaphore signal" ]
I also have a little problem, too. Why can I use my own C-Type UNUM32 at ...self ffiCall: #( T_ERROR StartMyThreadFunction(UNUM32 millisecondsToFire) ). But with FFICallback signature: # (void # (uint32 foo)) I get an error "Unable to resolve external type: UNUM32. Why is that?
Thanks for your help.
testDllForAsyncCallback.dll <http://forum.world.st/file/t372350/testDllForAsyncCallback.dll> testDllForAsyncCallback.cpp <http://forum.world.st/file/t372350/testDllForAsyncCallback.cpp> testDllForAsyncCallback.h <http://forum.world.st/file/t372350/testDllForAsyncCallback.h> testDllForAsyncCallback.h <http://forum.world.st/file/t372350/testDllForAsyncCallback.h> UFFICallback.st <http://forum.world.st/file/t372350/UFFICallback.st> CTypes.st <http://forum.world.st/file/t372350/CTypes.st> <http://forum.world.st/file/t372350/Transcript.png>
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html