winapi - Pthread win32 libraray, PTHREAD_PROCESS_SHARED not supported -
i using pthread win32 library implement mqueue. when runs following code, throw #40 error should enosys, means system not supported.
pthread_mutexattr_setpshared(&mattr, pthread_process_shared); = pthread_mutex_init(&mqhdr->mqh_lock, &mattr); pthread_mutexattr_destroy(&mattr); /* sure destroy */
i 40 after goes wrong. body has idea this? or have other alternative solution, use kind of win32 thread function replace it.
note: if implement mqueue in win32? thanks
you want read on windows interprocess synchronization functions.
for inter-process mutex in windows, choices implement own using shared memory , interlockedcompareexchange (spin sleep or watch event).
or easier program not performant use os provided named mutex object. these perform 10 times worse using criticalsection within threads of process.
in own production code porting linux pthreads, played first solution, ended releasing code using mutex solution. more reliable , sure work in cases.
Comments
Post a Comment