ipc

how can I notify a running activity from a broadcast receiver?

我只是一个虾纸丫 提交于 2019-12-28 09:56:31
问题 I have an activity, it needs to response to a broadcast event. Since an activity can not be a broadcast receiver at the same time, I made a broadcast receiver. My question is: how can I notify the activity from the broadcast receiver? I believe this is a common situation, so is there a design pattern for this? 回答1: The broadcast is the notification. :) If you want to say, start an activity or a service, etc., based on a received broadcast then you need a standalone broadcast receiver and you

how can I notify a running activity from a broadcast receiver?

为君一笑 提交于 2019-12-28 09:56:26
问题 I have an activity, it needs to response to a broadcast event. Since an activity can not be a broadcast receiver at the same time, I made a broadcast receiver. My question is: how can I notify the activity from the broadcast receiver? I believe this is a common situation, so is there a design pattern for this? 回答1: The broadcast is the notification. :) If you want to say, start an activity or a service, etc., based on a received broadcast then you need a standalone broadcast receiver and you

How do I synchronize access to shared memory in LynxOS/POSIX?

不打扰是莪最后的温柔 提交于 2019-12-28 05:31:09
问题 I am implementing two processes on a LynxOS SE (POSIX conformant) system that will communicate via shared memory. One process will act as a "producer" and the other a "consumer". In a multi-threaded system my approach to this would be to use a mutex and condvar (condition variable) pair, with the consumer waiting on the condvar (with pthread_cond_wait ) and the producer signalling it (with pthread_cond_signal ) when the shared memory is updated. How do I achieve this in a multi-process,

Linux进程间通信——共享内存

ぃ、小莉子 提交于 2019-12-27 21:36:28
相关知识参考: 1、 http://www.ibm.com/developerworks/cn/linux/l-ipc/part5/index1.html 2、 http://www.ibm.com/developerworks/cn/linux/l-ipc/part5/index2.html 下面的范例及描述来源http://www.cnblogs.com/feisky/archive/2010/03/24/1693488.html 最原始出处不详。 并进行了少许修改 一、基础知识: 共享内存是运行在同一台机器上的进程间通信最快的方式,因为数据不需要在不同的进程间复制。通常由一个进程创建一块共享内存区,其余进程对这块内存区进行读写。共享内存往往与其它通信机制,如信号量结合使用,来达到进程间的同步及互斥。 首先要用的函数是shmget,它获得一个共享存储标识符。 #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> int shmget(key_t key, int size, int flag); 这 个函数有点类似大家熟悉的malloc函数,系统按照请求分配size大小的内存用作共享内存。Linux系统内核中每个IPC结构都有的一个非负整数的 标识符,这样对一个消息队列发送消息时只要引用标识符就可以了

Exposing a winforms application internals through WCF

主宰稳场 提交于 2019-12-25 03:59:11
问题 I am trying to take my first steps into IPC and the WCF, and so far, I'm falling flat on my face. I have a Winforms application that I would like to instrument somewhat for remote callers. The winforms application has most of its business logic confined to a singleton that takes care of all the background work. I would like to expose some of the functionality through an IPC mechanism. WCF seems like the way forward, so I started out with that. What I tried is adding a WCF Service Library

Make c++ program to pass input output to windows command prommpt interactively

痞子三分冷 提交于 2019-12-24 16:54:30
问题 I want to make a simple program that starts a cmd.exe parallely and takes input from the user as a command, which is then passed to the cmd.exe, after execution my program should take the output from cmd.exe and display it to the user. Basically an interface to a command prompt. I don't want to use methods like system() as they start a new instance of cmd every time and I can't run commands like cd. I tried it with the following code with which I am able to spawn a cmd and show initial line

Most efficient matrix multiplication in C using fork() and IPC

半城伤御伤魂 提交于 2019-12-24 16:46:35
问题 I need to implement concurrent matrix multiplication in C using multiple processes. I understand that because each process has its own private address space, I will have to use some form of interprocess communication (IPC). I did some looking around and couldn't find many implementations that didn't use threads. I was wondering if anyone knew the most best way to go about this, either using shared memory, message passing, or pipes? I am not asking for a solution, but rather, if anyone knows,

Implementation of remote()

别等时光非礼了梦想. 提交于 2019-12-24 14:05:26
问题 I'm trying to find the implementation of remote(), as in: remote()->transact(CODE, data, &reply); Do you guys know where it is? Searching Google turned out futile. Or if you know what that function does, it would be a big help for me. Many thanks Update: it seems remote() will return a pointer to an object of type BBinder, IBinder, BpBinder, or IPCThreadState but I'm not sure which one. 回答1: The implementation of remote is simple: class BpRefBase : public virtual RefBase { protected:

IPC message queues how to send a vector of pairs

对着背影说爱祢 提交于 2019-12-24 11:21:13
问题 I'm trying to send and receive a message between 2 processes the struct as follows struct _st{ long _var1; int _var2; int _var3; int _var4; int _var5; vector <pair<int,int> > _var6; }; and my sending code is send_val = msgsnd(msgqid, &message, sizeof(message), !IPC_NOWAIT); and i receive it this way rec_val = msgrcv(msgqid, &message, sizeof(message), 0, !IPC_NOWAIT); when i assign my _var6 from the received message to another variable and print it's values i get garbage. How can i send and

Why is my ipcMain not sending to ipcRenderer in Electron?

醉酒当歌 提交于 2019-12-24 10:56:29
问题 New to electron I've figured out how to send from Renderer to Main but I'm trying to learn how to go from Main to Renderer . In my research I've read: IPC send from main process to renderer and tried: main.js : const { app, ipcMain, Menu } = require('electron') const appVersion = process.env.npm_package_version const mainWindow = require('./renderer/mainWindow') app.on('ready', () => { mainWindow.createWindow(), console.log(`Trying to send app version to renderer: ${appVersion}`), mainWindow