i am using a MYSQL database as form of IPC datastore between web client and C code process on Debian linux. When web client writes some data to the mysql database via php script, i need my C code app to go and pickup that data.
However i don’t want the C app continually polling some flag to check if data is available. Is there anyway it a thread can wait on some event from a mysql database or something that when signalled will allow it to unblock and process the data
Thanks
What you are trying to do is a little cumbersome, but it can work.
All you need to make it work is to use a trigger that will fire when data is inserted in the database.
The
triggerwill call a user-defined function (UDF) that in turn will signal yourCcode to start processing the newly inserted data.You don’t even need to write your own
UDF. You can use sys_exec from the lib_mysqludf_sys library to execute an external program.