'잡동사니'에 해당되는 글 13958건

  1. 2021.10.21 누리호 성공
  2. 2021.10.20 코로나 백신 후유증?
  3. 2021.10.20 c# thread
  4. 2021.10.20 Dispatcher / Control BeginInvoke()
  5. 2021.10.20 this.BeginInvoke()가 느려!
  6. 2021.10.19 ubuntu trim manually
  7. 2021.10.19 bazel clean
  8. 2021.10.19 web assembly
  9. 2021.10.19 크로스 스레드 작업이 잘못되었습니다
  10. 2021.10.18 winform 쓰레드와 소켓

필요한 테스트는 다 성공해놓고, 마무리에서 문제 있어 발사 실패라고 하는걸 보고 있노라니

무해한 나라 코스프레 중 이라는 느낌

 

[링크 : https://news.v.daum.net/v/20211021181610557]

Posted by 구차니

아내님 5일째 열이 나서

오늘 주사맞은 병원갔더니 대학병원가서 진료받아 보라고 해서 갔는데

코로나 검사결과지 들고 와야 함

그게 아니면 119로 응급실 들어와야 가능

그것도 아니면 6시간 기다릴래?

 

라는데 이게 무슨 우리 별이 짖는 소리도 아니고 -_-

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

휴가 3일차  (0) 2021.10.29
휴가 2일차  (0) 2021.10.28
화이자 2차 접종  (0) 2021.10.08
내일 백신 2차!  (0) 2021.10.07
코로나 3273  (0) 2021.09.25
Posted by 구차니
Programming/c# & winform2021. 10. 20. 14:13

abort는 그냥 죽어라! (보장은 안함) 라는 느낌이라면

join은 죽어줄때 까지 기다려 줄께~! 인데

코드 예제를 보면 abort는 서비스로 구성된 while 루프를 죽이고 있고

join은 일회성 쓰레드를 죽이는 예제로 설명되어 있는걸 보면..

맘편하게 abort로 죽어! 해야하려나?

 

[링크 : https://docs.microsoft.com/ko-kr/dotnet/standard/threading/destroying-threads]

 

쓰레드 보다는 간접적인 방법을 쓰라고 권장 -_ㅠ

.NET Framework 4부터 다중 스레딩을 사용하는 권장 방법은 TPL(작업 병렬 라이브러리)  PLINQ(병렬 LINQ)를 사용하는 것입니다. 자세한 내용은 병렬 프로그래밍을 참조하세요.

[링크 : https://docs.microsoft.com/ko-kr/dotnet/standard/threading/threads-and-threading]

 

 .NET Core는 Thread.Abort 메서드를 지원하지 않습니다. .NET Core에서 강제로 타사 코드 실행을 종료해야 하는 경우 별도의 프로세스에서 실행하고 Process.Kill를 사용합니다.

[링크 : https://docs.microsoft.com/ko-kr/dotnet/standard/threading/using-threads-and-threading]

 

obsolete를 사용되지 않는으로 해석해버렸군.

아무튼 abort는 .net 5.0 이후에서는 컴파일 경고가 뜬다고 하니

반강제적으로 TPL이나 PLINQ로 가게 만들려는 정책인듯?

이 메서드는 사용되지 않습니다. .NET 5.0 이상 버전에서이 메서드를 호출 하면 컴파일 타임 경고가 생성 됩니다. 이 메서드는 PlatformNotSupportedException 런타임에 .net 5.0 이상 및 .Net Core에서을 throw 합니다.

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.threading.thread.abort?view=net-5.0]

 

using System;
using System.Threading;

public class Example
{
   static Thread thread1, thread2;
   
   public static void Main()
   {
      thread1 = new Thread(ThreadProc);
      thread1.Name = "Thread1";
      thread1.Start();
      
      thread2 = new Thread(ThreadProc);
      thread2.Name = "Thread2";
      thread2.Start();   
   }

   private static void ThreadProc()
   {
      Console.WriteLine("\nCurrent thread: {0}", Thread.CurrentThread.Name);
      if (Thread.CurrentThread.Name == "Thread1" && 
          thread2.ThreadState != ThreadState.Unstarted)
         if (thread2.Join(TimeSpan.FromSeconds(2)))
            Console.WriteLine("Thread2 has termminated.");
         else
            Console.WriteLine("The timeout has elapsed and Thread1 will resume.");   
      
      Thread.Sleep(4000);
      Console.WriteLine("\nCurrent thread: {0}", Thread.CurrentThread.Name);
      Console.WriteLine("Thread1: {0}", thread1.ThreadState);
      Console.WriteLine("Thread2: {0}\n", thread2.ThreadState);
   }
}

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.threading.thread.join?view=net-5.0]

 

using System;
using System.Threading;

class Test
{
    public static void Main()
    {
        Thread newThread  = new Thread(new ThreadStart(TestMethod));
        newThread.Start();
        Thread.Sleep(1000);

        // Abort newThread.
        Console.WriteLine("Main aborting new thread.");
        newThread.Abort("Information from Main.");

        // Wait for the thread to terminate.
        newThread.Join();
        Console.WriteLine("New thread terminated - Main exiting.");
    }

    static void TestMethod()
    {
        try
        {
            while(true)
            {
                Console.WriteLine("New thread running.");
                Thread.Sleep(1000);
            }
        }
        catch(ThreadAbortException abortException)
        {
            Console.WriteLine((string)abortException.ExceptionState);
        }
    }
}

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.threading.thread.abort?view=net-5.0]

'Programming > c# & winform' 카테고리의 다른 글

c# postgresql 패키지  (0) 2022.04.27
winform udp 소켓 여러개  (0) 2021.10.26
Dispatcher / Control BeginInvoke()  (0) 2021.10.20
this.BeginInvoke()가 느려!  (0) 2021.10.20
크로스 스레드 작업이 잘못되었습니다  (0) 2021.10.19
Posted by 구차니
Programming/c# & winform2021. 10. 20. 12:21

'Programming > c# & winform' 카테고리의 다른 글

winform udp 소켓 여러개  (0) 2021.10.26
c# thread  (0) 2021.10.20
this.BeginInvoke()가 느려!  (0) 2021.10.20
크로스 스레드 작업이 잘못되었습니다  (0) 2021.10.19
winform 쓰레드와 소켓  (0) 2021.10.18
Posted by 구차니
Programming/c# & winform2021. 10. 20. 10:19

invoke()는 동기(blocking) 방식이고

begininvoke()는 비동기인데 메시지 큐에 넣어놓고 하는거 치고는 너무 느린데...

단순하게 키보드로 1,2,3,4 순서로 누르는 것 조차도 커버 못할 정도면

메시지 큐가 아니라 invoke 시퀀스에 먼가 문제가 있는 걸지도?

 

[링크 : https://stackoverflow.com/questions/50084323]

[링크 : https://yunhyeon.tistory.com/379]

'Programming > c# & winform' 카테고리의 다른 글

c# thread  (0) 2021.10.20
Dispatcher / Control BeginInvoke()  (0) 2021.10.20
크로스 스레드 작업이 잘못되었습니다  (0) 2021.10.19
winform 쓰레드와 소켓  (0) 2021.10.18
C# 트레이 아이콘 예제  (0) 2021.10.18
Posted by 구차니
Linux/Ubuntu2021. 10. 19. 23:59

 

 

$ fstrim -v /
fstrim: /: FITRIM ioctl failed: 명령을 허용하지 않음

$ sudo fstrim -v /
/: 197.8 GiB (212384423936 bytes) trimmed

[링크 : https://www.thefastcode.com/ko-krw/article/ubuntu-doesn-t-trim-ssds-by-default-why-not-and-how-to-enable-it-yourself]

'Linux > Ubuntu' 카테고리의 다른 글

ubuntu x86에서 arm용 아키텍쳐 패키지 추가하기(주의)  (0) 2022.01.28
debian 소스 받아 빌드하기  (0) 2021.12.02
ubuntu 무선 미러링  (0) 2021.07.13
gpsd 현재 좌표 얻기  (0) 2021.06.05
vino server without login  (0) 2021.04.14
Posted by 구차니

리눅스 홈 디렉토리 용량 검사하다 보니 이상하게 많이 먹어 추적해보니

~/.cache/bazel 이 7기가 정도?

bazel clean 을 통해서 용량을 감소시킬수 있다고 하는데 문제는 워크스페이스 날렸으면 무리

그냥 쿨(?) 하게 ~/.cache/bazel 을 날리니 용량이 훅 줄어든다.

$ bazel clean
Extracting Bazel installation...
ERROR: The 'clean' command is only supported from within a workspace (below a directory having a WORKSPACE file).
See documentation at https://docs.bazel.build/versions/master/build-ref.html#workspace

[링크 : https://github.com/Tencent/PhoenixGo/issues/76]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tflite bazel rpi3b+  (0) 2022.01.27
bazel cross compile  (0) 2022.01.27
2.7.0-rc with opencl  (0) 2021.10.13
tf release 2.7.0-rc  (0) 2021.10.12
tflite delegate  (0) 2021.10.11
Posted by 구차니
Programming/wasm2021. 10. 19. 18:25

이름만 듣고 먼 뻘짓인가 싶었는데

동영상 보고 나니 호기심이 가서 검색.

 

일단.. 내가 알던 그 어셈같은 뻘짓(?)은 아니고

다른 언어로 부터 한번 컴파일 해서 사용하는거라 상세(?) 언어 자체를 직접 구현할 필요는 없이

c나 rust, go 등으로 부터 컴파일 해서 나온 결과만을 쓰는 거라 문법 자체를 따로 공부할 이유는 없을 듯.

 

단지 그러한 기술이 있고 어떤 언어를 통해서 변환을 어떻게 하면 된다 정도만 알면 될 듯하다.

 

[링크 : https://webassembly.org/getting-started/developers-guide/]

[링크 : https://tech.kakao.com/2021/05/17/frontend-growth-08/]

[링크 : https://en.wikipedia.org/wiki/WebAssembly]

'Programming > wasm' 카테고리의 다른 글

wasm text 와 binary 상호변환  (0) 2021.10.26
emcc wasm 빌드  (0) 2021.10.25
wasm from c, cpp  (0) 2021.10.24
wasm  (0) 2021.10.22
wasm emcc  (0) 2018.10.24
Posted by 구차니
Programming/c# & winform2021. 10. 19. 17:18

쓰레드 만들어서 하는걸 해보지 않았으니 이런 경험을 다해보네 ㅠㅠ

(너무 늦었어!!!)

 

일단 UDP 소켓을 통해서 받은걸 UI에 쓰려고 했는데

UDP 소켓은 별도의 쓰레드로 생성해서 blocking 함수를 통해 받아오게 되어있다 보니

어떻게 보면 당연한거지만..

UDP 소켓 쓰레드에서 UI의 컨트롤 함수로 직접 접근을 하면 아래와 같은 에러가 발생하면서 죽어 버린다.

정확하게는 그냥 원인불명으로 죽어서, 디버거로 찍고 실행하니 이런 메시지가 발생한다.

System.InvalidOperationException: '크로스 스레드 작업이 잘못되었습니다. 'textBox1' 컨트롤이 자신이 만들어진 스레드가 아닌 스레드에서 액세스되었습니다.'

 

아무튼 아래와 같은 부분이 있어서 머야? 하고 빼버리긴 했었는데

이런 이유로 쓰레드에서 UI 쓰레드로 던지기 위해 invoke 해주는 함수를 거쳐서 던질 수 있게 하는 듯

this.BeginInvoke((Action<string>)DataReceivedUI, receivedMsg);

        private void DataReceivedUI(string data)
        {
            textBox1.Text += (data + "\n");
        }

[링크 : https://m.blog.naver.com/iconms1/221956474085]

 

근데, 키보드막 연타로 때리니 버벅댄다.

긴 걸 한번에 붙이는건 문제 없는걸 봐서, 저 함수를 이용하는건 쓰면 안 될 지도?

'Programming > c# & winform' 카테고리의 다른 글

Dispatcher / Control BeginInvoke()  (0) 2021.10.20
this.BeginInvoke()가 느려!  (0) 2021.10.20
winform 쓰레드와 소켓  (0) 2021.10.18
C# 트레이 아이콘 예제  (0) 2021.10.18
CGridctrl setitembkcolour  (0) 2021.09.01
Posted by 구차니
Programming/c# & winform2021. 10. 18. 16:20

'Programming > c# & winform' 카테고리의 다른 글

this.BeginInvoke()가 느려!  (0) 2021.10.20
크로스 스레드 작업이 잘못되었습니다  (0) 2021.10.19
C# 트레이 아이콘 예제  (0) 2021.10.18
CGridctrl setitembkcolour  (0) 2021.09.01
mfcimagegallery  (0) 2021.08.30
Posted by 구차니