Unreal already provides a way to lock access to textures: MainTex->GetPlatformData()->Mips[0]->BulkData->Lock(LOCK_READ_WRITE)
or MainTex->GetPlatformData()->Mips[0]->BulkData->LockReadOnly()
. Then use MainTex->GetPlatformData()->Mips[0].BulkData.Unlock()
to unlock the texture.
You can then use MainTex->GetPlatformData()->Mips[0]->BulkData->IsUnlocked()
to check if it’s been locked.
I don’t 100% understand your case but it sounds like you don’t really need the two threads writing to the same texture anyways.