I want to lock a table for adding new rows while my function is working. All new create and update queries should wait until the table is locked. How can I do this?