package Ġcom . example . student list . db Ċ Ċ import Ġandroidx . annotation . Worker Thread Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġcom . example . student list . entity . Student Ċ Ċ class ĠStudent Repository ( private Ġval Ġstudent Dao : ĠStudent Dao ) Ġ{ ĊĊĠĠĠ Ġval Ġall Student : LiveData < List < Student >> Ġ= Ġstudent Dao . getAll Students () ĊĊĠĠĠ Ġ//@ Worker Thread æłĩè®° è¦ģ åľ¨ å·¥ä½ľ çº¿ç¨ĭ æī§è¡Į ĊĠĠĠ Ġ// suspend Ġ çĶ¨äºİ æļĤ åģľ æī§è¡Į å½ĵåīį åįı ç¨ĭ ï¼Į å¹¶ ä¿ĿåŃĺ æīĢæľī å±Ģ éĥ¨ ä¾¿ æĿ¥ éĤ£ ä¸ª ĊĠĠĠ Ġ@ Suppress (" Red undant Suspend Modifier ") ĊĠĠĠ Ġ@ Worker Thread ĊĠĠĠ Ġsuspend Ġfun Ġinsert ( student : ĠStudent ) Ġ{ ĊĠĠĠĠĠĠĠ Ġstudent Dao . insert ( student ) ĊĠĠĠ Ġ} Ċ }