mirror of https://github.com/BOINC/boinc.git
Implement memory-mapped files for shared memory
svn path=/trunk/boinc/; revision=13470
This commit is contained in:
parent
e1681640ea
commit
25ec43a839
|
@ -17,12 +17,7 @@ extern void boinc_app_key_release(int, int);
|
|||
//
|
||||
extern void boinc_graphics_loop(int, char**);
|
||||
extern void* boinc_graphics_make_shmem(char*, int);
|
||||
|
||||
#ifdef USE_FILE_MAPPED_SHMEM
|
||||
// Use boinc_graphics_make_shmem() instead of boinc_graphics_get_shmem()
|
||||
#else
|
||||
extern void* boinc_graphics_get_shmem(char*);
|
||||
#endif
|
||||
|
||||
// Implementation stuff
|
||||
//
|
||||
|
|
|
@ -21,6 +21,7 @@ static void get_shmem_name(char* prog_name, char* shmem_name) {
|
|||
sprintf(shmem_name, "boinc_%s_%d", prog_name, aid.slot);
|
||||
}
|
||||
#else
|
||||
#ifndef USE_FILE_MAPPED_SHMEM
|
||||
static key_t get_shmem_name(char* prog_name) {
|
||||
char cwd[256], path[256];
|
||||
boinc_getcwd(cwd);
|
||||
|
@ -28,6 +29,7 @@ static key_t get_shmem_name(char* prog_name) {
|
|||
return ftok(path, 2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void* boinc_graphics_make_shmem(char* prog_name, int size) {
|
||||
#ifdef _WIN32
|
||||
|
@ -66,7 +68,7 @@ void* boinc_graphics_get_shmem(char* prog_name) {
|
|||
void* p;
|
||||
#ifdef USE_FILE_MAPPED_SHMEM
|
||||
struct stat sbuf;
|
||||
retval = stat(GFX_MMAPPED_FILE_NAME, &sbuf);
|
||||
int retval = stat(GFX_MMAPPED_FILE_NAME, &sbuf);
|
||||
if (retval == 0) {
|
||||
retval = create_shmem(GFX_MMAPPED_FILE_NAME, sbuf.st_size, &p);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue