Naming conventions for threads?

前端 未结 7 1930
南笙
南笙 2020-12-24 06:16

It\'s helpful to name threads so one can sort out which threads are doing what for diagnostic and debugging purposes.

Is there a particular naming convention for thr

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-24 06:57

    Hmmm... In the heavily multi-threaded applications I've written, I've generally had multiple threads executing the same function, so I'm not sure that naming threads is very helpful in that scenario. That said, I did assign each thread an integer ID which was printed in log messages generated by the thread to aid in debugging.

    For other applications that had threads with dedicated unique duties, yeah I named them descriptively... but I didn't do this because it was a threaded application, I did it because it is a coding best-practice to do so.

提交回复
热议问题