IPC: Is SendProcessMessage thread-safe?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

IPC: Is SendProcessMessage thread-safe?

Postby winapiwrapper » Mon Mar 12, 2018 4:49 pm

Hi everyone!

I need to send IPC messages to the renderer from two different threads in order to execute Javascript callbacks.

What would happen if those two threads called SendProcessMessage at the same time?
Would the behavior of SendProcessMessage be well-defined? If not, is there a special way to prevent two threads from calling this function at the same moment, or should I just use mutexes?
Can I send several messages to the renderer at the same time?
winapiwrapper
Techie
 
Posts: 35
Joined: Sat Feb 24, 2018 10:27 am

Re: IPC: Is SendProcessMessage thread-safe?

Postby magreenblatt » Mon Mar 12, 2018 4:55 pm

It is thread-safe in the browser process. In the renderer process it should only be called on TID_RENDERER.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: IPC: Is SendProcessMessage thread-safe?

Postby winapiwrapper » Mon Mar 12, 2018 5:42 pm

Thank you for the quick reply! :D
winapiwrapper
Techie
 
Posts: 35
Joined: Sat Feb 24, 2018 10:27 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 43 guests