x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Creation of extra RTHeartBeat threads in ThreadRegistry

I'm working on creating a threaded network listener, but I encountered something strange when running my project from the editor. I wanted to test if my threads are nicely cleaned-up after I shut down the thread. I found that I can check the ThreadRegistry to check which threads are active. However, I noticed that every time I run my application from the editor, two new threads are being created, making the number of threads grow. To check the number of threads, I added the following code to my BlueprintFunctionLibrary:

 void UMyBlueprintFunctionLibrary::ShowThreadPool()
 {
     int32 ThreadCount = FRunnableThread::GetThreadRegistry().GetThreadCount();
     UE_LOG(LogTemp, Display, TEXT("threads %d"), ThreadCount);
 
     FRunnableThread::GetThreadRegistry().Lock();
     for (auto Iter = FRunnableThread::GetThreadRegistry().CreateConstIterator(); Iter; ++Iter)
     {
         UE_LOG(LogTemp, Display, TEXT("Thread %s"), *(Iter.Value()->GetThreadName()));
     }
     FRunnableThread::GetThreadRegistry().Unlock();
 }

The declaration in the header looks like this:

 UFUNCTION(BlueprintCallable, Category = "Threading")
 static void ShowThreadPool();

In the level blueprint, I connected the BeginPlay and EndPlay events to my ShowThreadPool function. Each time I press Play, two new RTHeartBeat threads appear that don't seem to go away after stopping play. So for each run, the number of threads remains constant, but between plays, the number increases by two. I removed all my own threading code from the module and I still get this behavior. Is this intended behavior or is something not cleaned correctly? Since this also seems to appear in newly created projects, I'm guessing this is something inside the engine?

Product Version: Not Selected
Tags:
more ▼

asked Jan 20 '15 at 01:44 PM in C++ Programming

avatar image

mliem
3 3 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question