From: Marek P. <ma...@us...> - 2002-01-26 22:50:30
|
Update of /cvsroot/javaprofiler/library/src/commun3 In directory usw-pr-cvs1:/tmp/cvs-serv26803/src/commun3 Modified Files: communShMem.cpp communShMem.h semaphore.cpp semaphore.h Log Message: fixes of shared memory communication for win32 Index: communShMem.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/communShMem.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** communShMem.cpp 2002/01/26 10:19:44 1.7 --- communShMem.cpp 2002/01/26 22:50:27 1.8 *************** *** 161,170 **** #ifdef WIN32 ! #error FIXME #else pid_t* p = (pid_t*)((jint*)(_shmem.getAddress())+1); _pid = *p; ! *p = getpid(); #endif --- 161,173 ---- #ifdef WIN32 ! DWORD* p = (DWORD*)((jint*)(_shmem.getAddress())+1); ! ! _pid = *p; ! *p = GetCurrentProcessId(); #else pid_t* p = (pid_t*)((jint*)(_shmem.getAddress())+1); _pid = *p; ! *p = getpid(); #endif *************** *** 177,181 **** #ifdef WIN32 ! #error FIXME #else return !kill( _pid, 0); --- 180,184 ---- #ifdef WIN32 ! return GetProcessVersion( _pid); #else return !kill( _pid, 0); Index: communShMem.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/communShMem.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** communShMem.h 2002/01/26 10:19:44 1.6 --- communShMem.h 2002/01/26 22:50:27 1.7 *************** *** 65,69 **** #ifdef WIN32 ! #error FIXME #else /// client process ID --- 65,70 ---- #ifdef WIN32 ! /// client process ID ! DWORD _pid; #else /// client process ID Index: semaphore.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/semaphore.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** semaphore.cpp 2002/01/26 10:19:44 1.2 --- semaphore.cpp 2002/01/26 22:50:27 1.3 *************** *** 38,43 **** #ifdef WIN32 ! #error FIXME ! // _semid = CreateSemaphore( NULL, (( locked) ? 0 : 1), 1, name); #else _semid = semget( *(key_t*)(const char*)name, 1, 0666 | IPC_CREAT); --- 38,42 ---- #ifdef WIN32 ! _semid = CreateSemaphore( NULL, 0, 1, name); #else _semid = semget( *(key_t*)(const char*)name, 1, 0666 | IPC_CREAT); *************** *** 49,55 **** #ifdef WIN32 ! #error FIXME ! // CloseHandle( _semid); ! #else #endif } --- 48,52 ---- #ifdef WIN32 ! CloseHandle( _semid); #endif } *************** *** 58,64 **** #ifdef WIN32 ! #error FIXME ! // WaitForSingleObject( _semid, INFINITE); ! // Sleep( 0); #else static sembuf sop[2] = { 0, 0, 0, 0, 1, SEM_UNDO}; --- 55,59 ---- #ifdef WIN32 ! WaitForSingleObject( _semid, INFINITE); #else static sembuf sop[2] = { 0, 0, 0, 0, 1, SEM_UNDO}; *************** *** 70,76 **** #ifdef WIN32 ! #error FIXME ! // ReleaseSemaphore( _semid, 1, NULL); ! ////Sleep( 0); #else static sembuf sop = { 0, -1, SEM_UNDO | IPC_NOWAIT}; --- 65,69 ---- #ifdef WIN32 ! ReleaseSemaphore( _semid, 1, NULL); #else static sembuf sop = { 0, -1, SEM_UNDO | IPC_NOWAIT}; *************** *** 81,87 **** void Semaphore::reset() { ! #ifdef WIN32 ! #error FIXME ! #else semctl( _semid, 0, SETVAL, 1); #endif --- 74,78 ---- void Semaphore::reset() { ! #ifndef WIN32 semctl( _semid, 0, SETVAL, 1); #endif Index: semaphore.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/semaphore.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** semaphore.h 2002/01/26 10:19:44 1.7 --- semaphore.h 2002/01/26 22:50:27 1.8 *************** *** 84,88 **** /** Reset semaphore. It resets semaphore and sets its ! ** default value (locked by one). */ void reset(); --- 84,89 ---- /** Reset semaphore. It resets semaphore and sets its ! ** default value (locked by one). Implemented only ! ** on Unix systems because of troubles with JVM. */ void reset(); |